Flags
gglobal: find every match, not just the first.iignore case.mmultiline:^and$match at line breaks.sdotAll:.also matches newlines.uUnicode: treat surrogate pairs as one character and allow\p{...}classes.ysticky: match only atlastIndex.dindices: return start and end positions of groups.
Avoid catastrophic backtracking
Patterns with nested quantifiers like (a+)+ or (.*)* can take exponential time on inputs that almost match. One such pattern in a firewall rule took a whole CDN down in 2019; see the Cloudflare outage explained. Prefer specific character classes over .*, anchor patterns, and limit input length before matching untrusted text.
Regex in monitoring
Keyword checks on uptime monitors, log-based alerts and log parsing all use regular expressions. Test them here against real log lines first: a pattern that never matches fails silently, and an alert that never fires is worse than none. See alerting best practices.
Using it safely at work
Online developer tools are a common way secrets leak: people paste production tokens, customer records or private keys into a website that quietly logs them. This page does all its work in your browser with standard Web APIs, makes no network request with your input, and stores nothing, so it is safe to use with real data, and you can confirm that in your browser’s network panel. Even so, treat anything you paste as you would treat a screenshot: rotate a token that was exposed, never share links that contain it, and prefer command-line tools on the server itself for very sensitive material.