A common security vulnerability
- https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
- https://www.npmjs.com/package/safe-regex
- https://github.com/substack/safe-regex
- https://github.com/jviereck/regjsparser
- avoid using them to match code, since the code itself can contain a regexp and that'll trigger weirdness
- when using
.exec
remember to reset thelastIndex
otherwise the regexp will start from where the last run finished - understand the difference between
test
(simple bool),exec
(runs to first match) andmatch
(returns null if no match) - understand that you can use
.replace
for string walking using a function callback
Drafts may be incomplete or entirely abandoned, so please forgive me. If you find an issue with a draft, or would like to see me write about something specifically, please try raising an issue.