Is it possible to change the dialect of vime regexp?

Inside Vim, the \ (\) character sequence is used to group some characters. The same behavior applies to other specialties: \ {\}.

Is it possible to change the style of a regular expression, as in perl? How to enable it?

Instead

\\( 

I'd

 ( 

???

+7
source share
1 answer

You can change the default "magic level"

 :se nomagic :se magic 

See :he magic

I would recommend using appropriate screens so as not to break other comparisons.

  /\v(\d+) 

will match sequential digits as you would expect with Perl Regex

From pattern.txt help:

 Examples: after: \v \m \M \V matches ~ 'magic' 'nomagic' $ $ $ \$ matches end-of-line . . \. \. matches any character * * \* \* any number of the previous atom () \(\) \(\) \(\) grouping into an atom | \| \| \| separating alternatives \a \a \a \a alphabetic character \\ \\ \\ \\ literal backslash \. \. . . literal dot \{ { { { literal '{' aaaa literal 'a' {only Vim supports \m, \M, \v and \V} It is recommended to always keep the 'magic' option at the default setting, which is 'magic'. This avoids portability problems. To make a pattern immune to the 'magic' option being set or not, put "\m" or "\M" at the start of the pattern. 
+11
source

All Articles