Re:Regular Expressions – Mastering Lookahead and Lookbehind
by thefifthsetpin on Friday March 16, 2018 @11:30AM
(#16601317)
I generally include either \v or \V in my vim regex, at which point I no longer have to think about which characters are magic. I suppose this means that I agree that vim's default is annoying here, but imho vim more than makes up for that by making magic configurable.
Re:Regular Expressions – Mastering Lookahead and Lookbehind
by ken on Friday March 16, 2018 @11:37AM
(#16601364)
> They all follow the basic standards, with [] being character classes, () being submatches
You've already described a feature which has different syntax in one of the primary regex dialects I use (Emacs).
Re:Regular Expressions – Mastering Lookahead and Lookbehind
by pygy_ on Saturday March 17, 2018 @04:01AM
(#16606006)
That's the syntactic differences, but there are also semantic ones.
Most notably, the choice operator can either be ordered like in PEGs (if the first branch matches, the other isn't evaluated) or pick the branch that produces the longest match, CFG-like.
The two main differences between various engines are which characters are "literal" and which characters are "magic" (Vim's engine is particularly annoying here), and how to write the "convenience character classes" (like what the shorthand for "alphanumeric character class" is). But these are minor issues, once you've learned how to write a regex, these are trivial to look up.
Knowledge of regular expressions transfer from one engine to another just fine.