You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifies the boundaries around which strings will be replaced. By default, delimiters are [word boundaries](https://www.regular-expressions.info/wordboundaries.html) and also prevent replacements of instances with nested access. See [Word Boundaries](#word-boundaries) below for more information.
66
+
Specifies the boundaries around which strings will be replaced. By default, delimiters match JavaScript identifier boundaries and also prevent replacements of instances with nested access. See [Word Boundaries](#word-boundaries) below for more information.
67
67
For example, if you pass `typeof window` in `values` to-be-replaced, then you could expect the following scenarios:
68
68
69
69
-`typeof window`**will** be replaced
70
-
-`typeof window.document`**will not** be replaced due to `(?!\.)` boundary
71
-
-`typeof windowSmth`**will not** be replaced due to a `\b` boundary
70
+
-`typeof window.document`**will not** be replaced due to the `(?!\.)` boundary
71
+
-`typeof windowSmth`**will not** be replaced due to identifier boundaries
72
72
73
73
Delimiters will be used to build a `Regexp`. To match special characters (any of `.*+?^${}()|[]\`), be sure to [escape](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping) them.
74
74
@@ -194,7 +194,7 @@ replace({
194
194
195
195
## Word Boundaries
196
196
197
-
By default, values will only match if they are surrounded by _word boundaries_.
197
+
By default, values will only match if they are surrounded by _word boundaries_ that respect JavaScript's rules for valid identifiers (including `$` and `_` as valid identifier characters).
0 commit comments