Reputation: 930
When searching with a regex I want .*
to match line separators (\n
). To do it you should add s
flag, but I can't quite figure out how to do it. Is there a way to add regex flags in PhpStorm?
Upvotes: 6
Views: 1277
Reputation: 627128
Use a DOTALL inline modifier option:
(?s).*
^^^^
This pattern means that all .
to the right of the (?s)
will also match line break chars.
Inline Modifier
(?s)
In .NET, PCRE (C, PHP, R…), Perl, Python and Java (but not Ruby), you can use the inline modifier(?s)
, for instance in(?s)BEGIN .*? END
. See the section on inline modifiers for juicy details about three additional features (unavailable in Python): turning it on in mid-string, turning it off with(?-s)
, or applying it only to the content of a non-capture group with(?s:foo)
Upvotes: 10