Here's the reduced case of PHP code:
use Package;
use Package2;
class {
use Trait;
function fn() {
function() use ($var) {
}
}
}
I'd like to match only the use
before Package;
and Package2;
not use Trait
nor use ($var)
Nothing like negative lookahead and negative lookbehind seem to work. Tried this approach Regular Expression, match characters outside curly braces { }
Obviously doesn't work: https://regex101.com/r/L6N4Ye/1
Using the PCRE interpreter.