I notice the standard regex syntax for matching across multiple lines is to use /s, like so:
This is\nsome text
/This.*text/s
This works in Perl for instance but doesn't seem to be supported in Vim. Instead, I have to be much more specific:
/This[^\r\n]*[\r\n]*text/
I can't find any reason for why this should be, so I'm thinking I probably just missed the relevant bits in the vim help.
Can anyone confirm this behaviour one way or the other?
ベストアンサー1
Yes, Perl's //s
modifier isn't available on Vim regexes. See :h perl-patterns
for details and a list of other differences between Vim and Perl regexes.
Instead you can use \_.
, which means "match any single character including newline". It's a bit shorter than what you have. See :h /\_.
.
/This\_.*text/