From ECMAScript 2018 onwards, many of JavaScript's regex deficiencies have been fixed.
What is still missing:
- JavaScript doesn't have a way to prevent backtracking by making matches final (using possessive quantifiers
++
/*+
/?+
or atomic groups (?>...)
).
- Recursive/balanced subgroup matching is not supported.
- One other (cosmetic) thing is that JavaScript doesn't know verbose regexes, which might make them harder to read.
Other than that, the basic regex syntax is very similar in both flavors.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…