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 modifiergto get all occurrences.It should look than like this:
/#file "([^"]*)";;((?:(?!#file).)*)/gimsTest it here: http://www.regex101.com/r/cC5tK5