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?
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With