File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,16 @@ const matchK = match.on('kind').w
9
9
10
10
const repr = ( n : number ) : string =>
11
11
// < 32 -> control characters
12
- // 45 -> '-'.. seems like `/[--z]/` for example actually works, but looks weird.
12
+ // 45 -> '-'.. seems like `/[--z]/` for example actually works, but looks
13
+ // weird.
14
+ // 47 -> '/' doesn't need to be escaped in JS, but it's helpful for copying
15
+ // into regex debuggers since it must be escaped in some languages
16
+ // 92 -> '\' just to avoid any issues with escaping
13
17
// 93 -> ']' which needs to be escaped
14
18
// 94 -> '^' which might get parsed as class exclusion marker, so escape just in case
15
19
// 127 -> del
16
20
// >127 -> outside normal ascii range. escape 'em
17
- n < 32 || n === 45 || n === 93 || n === 94 || n >= 127
21
+ n < 32 || n === 45 || n === 47 || n === 92 || n === 93 || n === 94 || n >= 127
18
22
? n > 255
19
23
? `\\u${ n . toString ( 16 ) . padStart ( 4 , '0' ) } `
20
24
: `\\x${ n . toString ( 16 ) . padStart ( 2 , '0' ) } `
You can’t perform that action at this time.
0 commit comments