Skip to content

Commit 6bd1933

Browse files
committed
Readme: partial revert
1 parent 45194e4 commit 6bd1933

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,24 +386,24 @@ regex`[a${partial`^`}]`
386386

387387
Although `[^…]` is a negated character class, `^` ***within*** a class doesn't need to be escaped, even with the strict escaping rules of flags <kbd>u</kbd> and <kbd>v</kbd>.
388388

389-
Both of these examples therefore match a literal `^`. They don't change the meaning of the surrounding character class. However, note that the `^` is not simply escaped. `partial('^^')` embedded in character class context would still correctly lead to an "invalid set operation" error due to the use of a reserved double-punctuator.
389+
Both of these examples therefore match a literal `^`. They don't change the meaning of the surrounding character class. However, note that the `^` is not simply escaped. `` partial`^^` `` embedded in character class context would still correctly lead to an "invalid set operation" error due to the use of a reserved double-punctuator.
390390

391391
> If you wanted to dynamically choose whether to negate a character class, you could put the whole character class inside the partial.
392392
393393
Moving on, the following lines all throw because otherwise the partial patterns would break out of their interpolation sandboxes and change the meaning of their surrounding patterns:
394394

395395
```js
396-
regex`(${partial`)`})`
397-
regex`[${partial`]`}]`
398-
regex`[${partial`a\`}]]`
396+
regex`(${partial(')')})`
397+
regex`[${partial(']')}]`
398+
regex`[${partial('a\\')}]]`
399399
```
400400

401401
But these are fine since they don't break out:
402402

403403
```js
404-
regex`(${partial`()`})`
405-
regex`[\w--${partial`[_]`}]`
406-
regex`[${partial`\\`}]`
404+
regex`(${partial('()')})`
405+
regex`[\w--${partial('[_]')}]`
406+
regex`[${partial('\\\\')}]`
407407
```
408408

409409
Partials can be embedded within any token scope:

0 commit comments

Comments
 (0)