JavaScript vs PCRE
What this is
regex101 wins on flavor switching. This tool is honest: it runs your browser's ECMAScript engine. Differences that bite: no \A \Z in JS (use ^ $ with care), no possessive *+, no atomic groups, lookbehind rules differ, \d is ASCII unless u, replacement $` $' $n differ in Ruby. When you paste a PCRE pattern, expect breakage on x-flag comments and recursive subpatterns.
FAQ
- Go RE2?
- RE2 rejects backreferences and lookaround. A JS pattern that works here may be rejected by regexp.Compile.