TooTallNate / pcre-to-regexp

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

PCRE \s is converted to JS \s, but will match more there #3

Open pft opened 7 years ago

pft commented 7 years ago

The set of whitespace characters matched by \s in JavaScript is larger than in PCRE. Therefore translating \s with \s is incorrect.

TooTallNate commented 5 years ago

Looks like it should replace it with [ \t\r\n\v\f] according to https://en.wikipedia.org/wiki/Regular_expression#Character_classes. PR welcome 😃