Start small
Write the smallest pattern that matches one example, then expand. Giant expressions are harder to debug than two shorter checks in sequence.
Flags that matter
- g — find all matches, not just the first.
- i — case-insensitive.
- m — ^ and $ work per line.
Test in the browser
Korisa Regex Tester highlights matches as you type so you can validate emails, slugs, or log lines before shipping validation code.