# Regex tester > How does your regular expression match, step by step? Test a JavaScript regular expression on your text, see every match and group, and read the pattern in plain words. Test a JavaScript regular expression on your own text, see each match and capture group highlighted and read what every part of the pattern means. - Page: https://how.box/regex/ - Runs entirely in the browser. - License: HowToolbox's own text and data (titles, explanations, FAQs, tool descriptions and schemas, this file) are CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); AI training and answers are welcome. Attribute "HowToolbox (how.box)" with a link to the page used. Third-party data keeps its own terms; the name and logo are not licensed. Publisher: HowToolbox, contact@how.box. Terms: https://how.box/about/terms/ ## Inputs Answer link: https://how.box/regex/?pattern={pattern}&flags={flags}&text={text} - `pattern` (text): The regular expression source, without slashes. Example: `(\d{4})-(\d{2})-(\d{2})`. - `flags` (text): JavaScript flags such as g, i, m, s, u, v, y. Example: `gi`. - `text` (text): The text to test. Example: `Sent on 2026-11-07.`. Example answer: https://how.box/regex/?pattern=%28%5Cd%7B4%7D%29-%28%5Cd%7B2%7D%29-%28%5Cd%7B2%7D%29&flags=gi&text=Sent+on+2026-11-07. The page computes the answer in the browser: read results from the agent tools below, not from the page HTML. ## Agent tools - `regex_test`: Tests a JavaScript regular expression against a text, in the browser, and explains the pattern. - MCP, one POST to https://how.box/mcp: `{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"regex_test","arguments":{"pattern":"(\\d{4})-(\\d{2})-(\\d{2})","flags":"gi","text":"Sent on 2026-11-07."}}}` - GET: https://how.box/mcp/run/regex_test?pattern=%28%5Cd%7B4%7D%29-%28%5Cd%7B2%7D%29-%28%5Cd%7B2%7D%29&flags=gi&text=Sent+on+2026-11-07. ## How it works A regular expression is a pattern that describes text. Letters match themselves, \d stands for a digit, a dot for almost any character, and brackets list the characters allowed in one place. Quantifiers say how many times to repeat the part before them: a star for any number, a plus for at least one, a question mark for optional. Round brackets group parts and capture what they matched. The browser's own regular expression engine does the matching, so the result is what JavaScript gives you. The engine tries the pattern from each position and backs up when a choice fails. Quantifiers are greedy and take as much as they can, unless a question mark after them makes them lazy. Some patterns, such as a repeated group that itself contains a repeat, make the engine try an enormous number of ways on certain texts: that is catastrophic backtracking, and it can freeze a page. To keep the page responsive, patterns of that kind are recognised and not run, and patterns that can be slow limit how long the text may be. The check recognises the known risky shapes; it cannot prove every other pattern safe. Other languages have their own flavours, so lookbehind, named groups and Unicode escapes may behave differently outside JavaScript. ## FAQ **What does the g flag do?** It finds every match in the text instead of stopping at the first one. **What is the difference between greedy and lazy?** A greedy quantifier takes as much text as it can, a lazy one (with a question mark after it) as little as it can. Against a tag in angle brackets, .* takes up to the last closing bracket and .*? stops at the first. **How do I match a literal dot or bracket?** Put a backslash before it, for example \. for a dot. Inside square brackets most of these characters are already literal. **Why was my pattern not run?** It has a shape that can backtrack catastrophically, such as a repeat inside a repeat. Rewrite it so each part can match in only one way, for example (a+)+ becomes a+. **Does it use the same engine as my code?** Yes, for JavaScript and TypeScript. For other languages the common syntax is the same, but details such as lookbehind and flags can differ. More: [HowToolbox index](https://how.box/llms.txt) · [Agent Skill](https://how.box/skill.md) · [agent terms](https://how.box/about/agents/)