tc39 / proposal-regexp-r-escape

Regular Expression `\R` Escape for ECMAScript
https://tc39.es/proposal-regexp-r-escape
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

Should `\R` match LineTerminator or the expanded set in UAX14? #2

Closed rbuckton closed 2 years ago

rbuckton commented 2 years ago

ECMAScript defines ^ and $ to match the following characters from LineTerminator:

However, UAX14 specifies additional characters and most other implementations of \R match the following:

The current proposal matches the expanded list, above, but this does not align with ^ or $ matching. I'm leaning towards consistency with other implementations over consistency with ^ and $ currently, but would appreciate feedback.

rbuckton commented 2 years ago

The goal of this proposal is to match line terminator sequences, including CRLF. To avoid an arbitrary inconsistency with \R in other languages, I've chosen to have \R match the 2nd list of characters:

This is reflected in the current specification text.