Reputation: 195
I have small problem with preg_match_all and \n
MY reqular expression:
/\s*DEF\s+FUNC\s+(\w+\d*)\((\w*[,\s\w]*|)\)\s*{\s*(.*)\s*};/
it works for text:
DEF FUNC test()
{
test1
};
but this doesnt work for text:
DEF FUNC test()
{
test1
test1
};
I'm fighting with this 3 hours ;/ Can somebody help me ?
Thanks
Upvotes: 1
Views: 185
Reputation: 6381
According to this: http://php.net/manual/en/reference.pcre.pattern.modifiers.php
you have to use the s
(PCRE_DOTALL) flag
Upvotes: 2
Reputation: 9644
The wildcard .
doesn't match newlines by default.
If you want it to, you have to add the flag s
(PCRE_DOTALL):
preg_match_all($regex, $in, $out, PCRE_DOTALL)
Upvotes: 1