Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit de7b32f

Browse files
committed
Merge pull request #35 from bergus/patch-1
fix example for hexadecimal escape
2 parents 53ebda3 + b556b74 commit de7b32f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

EscapedChars.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ And __only at the start__ of strings:
3838
|Character | Why escape it?
3939
|-----------|--------------|
4040
| `0-9` | So that in `new RegExp("(foo)\\1" + RegExp.escape(1))` the back reference will still treat the first group and not the 11th and the `1` will be taken literally - see [this issue](https://github.com/benjamingr/RegExp.escape/issues/17) for more details. |
41-
| `0-9a-fA-F` | So that `new RegExp("\\u41" + RegExp.escape("B"))` will not match the letter "Л" (`\u041B`) but rather the sequence "AB", or more generally that a leading hexadecimal character may not continue a preceding escape sequence - see [this issue](https://github.com/benjamingr/RegExp.escape/issues/29) for more details. |
41+
| `0-9a-fA-F` | So that `new RegExp("\\u004" + RegExp.escape("A"), "u")` will not match the letter "J" (`\u004A`) but rather throw a type error (or that without the `u` flag, the sequence "u004A" would be matched, `\u` being an identity escape), or more generally that a leading hexadecimal character may not extend a preceding escape sequence - see [this issue](https://github.com/benjamingr/RegExp.escape/issues/29) for more details. |
4242

4343
Note that if we ever introduce named capturing groups to a subclass of the default `RegExp` those would also need to escape those characters.
4444

0 commit comments

Comments
 (0)