Need regexp for following data:
#file "scripts\generate.c";;
void Generate()
adsasd
asdasdas
asdasd
#file "a.c";;
void asdad()
asdasd
asdasd
which will return file and code like so:
Array(
[0] => scripts\generate.c
[1] =>
void Generate()
adsasd
asdasdas
asdasd
)
... and same for #file "a.c";;
Your first try was nearby correct. Just change ((?!#file .*).)*
to ((?:(?!#file).)*)
and also add the modifier g
to get all occurrences.
It should look than like this: /#file "([^"]*)";;((?:(?!#file).)*)/gims
Test it here: http://www.regex101.com/r/cC5tK5