I have an input like this
var example = ...
var foobar = function() {
var barfoo = function() {
}
}
var something = ...
I want to extract the function foobar.
How can I extract the text from var foobar
until a closing bracket which is at the first indentation level?
preg_match('#var foobar =.*^}/#ms', $this->body, $matches);
Does not give any matches.