3 ms·
Ask HN: Better Regex Support for JavaScript?
My understanding is that regex in JavaScript is fairly crippled. http://www.regular-expressions.info/javascript.html lists a number of missing features. The most salient of these seem to be:
# Lookbehind is not supported at all. Lookahead is fully supported.
# No atomic grouping or possessive quantifiers
One way to fix this would be to write a regex engine in JS. Does anyone know of any such projects? Alternatively, does anyone know of any other ways of supporting fully-featured regex in JS?
(Making a request out to a web service written in a language with better regex support is the default option, but I'm hoping to find something with less external dependencies.)
Thanks!
- skennedy 17y agoSomeone who offers three solutions to mimic lookbehind's in Javascript: http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript/comment-page-1 http://blog.stevenlevithan.com/archives/mimic-lookbehind-jav... Also, there seems to also be a lot of support for leveraging PHP's regex functionality on the server-side to accomplish this.