UNPKG
@samlevy/string-helpers
Version:
latest (1.2.0)
1.2.0
1.1.0
1.0.1
1.0.0
Basic string helper functions
github.com/samlev/string-helpers
samlev/string-helpers
@samlevy/string-helpers
/
src
/
regex
/
sanitize.ts
7 lines
(6 loc)
•
163 B
text/typescript
View Raw
1
2
3
4
5
6
7
/** * Escapes regular expression characters in a string. * *
@param
str */
export
default
(str:
string
):
string
=> str.
replace
(/[|\\{}()[\]^$+*?.]/g,
"\\$&"
);