Testing regular expressions safely
JavaScript flavor
Browsers implement a Perl-inspired regex flavor with differences around lookbehind and Unicode property escapes by engine version. Test in the same environment you ship.
Flags
g global, i ignore case, m multiline ^$, s dotAll, u Unicode. Missing flags are a top cause of “it worked in the demo” bugs.
Catastrophic backtracking
Nested quantifiers on ambiguous patterns can freeze a tab. Keep patterns simple; prefer possessive ideas or explicit character classes when parsing untrusted input.
Worked example
Pattern \d{3}-\d{4} on 555-1234 matches a simple phone fragment. It is not a full national phone validator.
Limits
Not a substitute for a parser. HTML and email addresses need dedicated libraries.
FAQ
Q: Why educational warnings? A: Regex looks short but can be expensive and wrong for complex languages.
Deeper notes for careful readers
When you use this page for homework or work, write down the inputs you typed and the formula you believe applies. Then recompute once by hand or with a second method. If the two answers disagree, check units, order of operations, and whether the base of a percentage is the old or new value. Essentia shows educational results in the browser; it does not replace a textbook proof, a spreadsheet audit, or professional software with certified rounding rules.
Practice checklist
1) State the question in one sentence. 2) Name the formula. 3) Plug in numbers with units. 4) Sanity-check magnitude (too big or too small?). 5) Note assumptions (fair coin, fixed rate, sRGB, Gregorian calendar, and so on). Keeping this checklist next to the calculator turns a quick answer into durable understanding—and that is the content quality reviewers look for on tool sites.
When not to use regex
HTML, CSV with quoting, and nested structures need parsers. Regex is excellent for light validation and search-and-replace, poor for full languages. On untrusted input, bound the length you scan and avoid evil patterns with nested quantifiers. Essentia’s tester helps you see matches; production code should add timeouts or safer alternatives when needed.