I use Regexr (regexr.com) to quickly test out my regexes. It supports JS style regex. and is very handy since it has features like live preview, and explanation of your regex.
For explaining regex, I mostly try to create simple and small regex, and assign it to some const (or function) to make it understandable.
e.g. I'll never do if (/regex/.test(str)), but always const EMAIL_REGEX = /regex/, and then my code.
For solving problems, I use it to sometimes modify data structures on the fly, and code refactor.
I also recently wrote a post about it: dev.to/admitkard/regexp-cheatsheet...
I use Regexr (regexr.com) to quickly test out my regexes. It supports JS style regex. and is very handy since it has features like live preview, and explanation of your regex.
For explaining regex, I mostly try to create simple and small regex, and assign it to some const (or function) to make it understandable.
e.g. I'll never do
if (/regex/.test(str))
, but alwaysconst EMAIL_REGEX = /regex/
, and then my code.For solving problems, I use it to sometimes modify data structures on the fly, and code refactor.
I also recently wrote a post about it: dev.to/admitkard/regexp-cheatsheet...
RegExp Cheatsheet to speed up code editing and refactor
Piyush Kumar Baliyan for AdmitKard ・ Jan 4 ・ 5 min read