TooTallNate / pcre-to-regexp

Converts PCRE regexp strings to JavaScript RegExp instances
MIT License
22 stars 6 forks source link

Enhancement : Support ?R #7

Open noftaly opened 5 years ago

noftaly commented 5 years ago

Hi, i tried to convert this PCRE regex : /{(?!_@)([^{}]|(?R))*}/gi, because, as you can see, it contains the ?R identifier, wich is not supported by the javascript's regex engine.

I had an error : (node:3282) UnhandledPromiseRejectionWarning: SyntaxError: Invalid regular expression: /{(?!_@)([^{}]|(?R))*}/: Invalid group, but i figured out it was just that ?R is not supported yet.

So it would be great if you can add it ! It is a recursive identifier (i think 😂)

(And by the way, instead of throwing an error, it should send a warning like "?R" identifier is not supported yet., it would be easier to understand, because first i though i had something wrong in my regex ^^)

Thanks !