Skip to content

Commit 6fe67c0

Browse files
authored
Clarify that minimal escaping is done and describe edge cases (#40)
1 parent ba9a447 commit 6fe67c0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ new RegExp(escapedString);
2121

2222
You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.
2323

24+
Only the minimal amount of escaping is done, and developers are expected to insert escaped strings at safe positions in a `RegExp`. This keeps the output simple and gives you the best results in most cases. For edge case placements of escaped strings (such as immediately following `\0` or `\c`), the escaped value can change the meaning of the preceding or following token. If fully context-aware escaping is needed, consider interpolating a string using the [`regex`](https://github.com/slevithan/regex#interpolating-escaped-strings) package.
25+
2426
---
2527

2628
<div align="center">

0 commit comments

Comments
 (0)