I have this regex
^\([^\t]*\)\t\([^\t]*\)\t\([^\t]*\)$
which is supposed to match
In Vim, this works fine:
But in Sublime it will not match. Why?
Vim regex is rather specific and differs from the PCRE regex engine expression syntax that Sublime Text 3 uses.
In Sublime Text 3, you can write the pattern you used in Vim as
^([^\t\r\n]*)\t([^\t\r\n]*)\t([^\t\r\n]*)$
See the regex demo
In short, (...)
should be used to form a capturing group, and you need to add \r\n
to disallow a negated character class to match across lines (in Vim, [^.]*
won't match a line break, but it will in Sublime Text 3).
Note that (...)
(and not \(...\)
) can also be used as a capturing group in Vim, but you need to use very magic mode to use that syntax.
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