简体   繁体   中英

How to use RegEx flags in PhpStorm's “Find and Replace”?

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 (?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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM