Reputation: 8801
For example, if I wanted to match text with multiple lines I could use the /s
modifier in preg_match.
Or I could use a character class like [^!]+
instead of the .+
. (assuming I didn't have any exclamation points in my RegEx)
Problem is there might be an exclamation mark sometimes. Also, when I do this it is greedy and matches all the way to the end.
Sorry for the newbie question but I can't test /s
in http://regexpal.com/ and I really like its interface. Basically I want a character class that won't be used in the text and one that isn't greedy so it doesn't try to go as far as it can.
Thanks!
Upvotes: 0
Views: 95
Reputation: 77454
What about using
(.|\n)
That should explicitely allow newlines, too.
Upvotes: 1