Is 2regex free?
Yes. Every tool is free, with no account, no usage limits, and no paid tier.
Test a pattern against real text, see every match and capture group, preview a replacement, and read what the pattern means in plain English.
Loading the workbench.
You do not have to take our word for it. Developer tools show every request a page makes, so you can watch 2regex work and confirm that nothing is sent. Auditable trust is worth more than a badge, and the check takes under a minute.
F12, or Cmd+Option+I on a Mac, and select the Network tab.Only three things can add a line to that log, and none of them carries your text. Submitting the feedback form sends the vote and comment you typed. Pasting text in a script the page has not displayed yet, such as Cyrillic or Greek, can make the browser fetch the matching font file, and that request names only the font. When a runaway pattern is stopped, the browser restarts the matching worker from a blob: address, which is a copy held in this tab's memory and does not touch the network.
The production site also sends a Content-Security-Policy header that tells your browser to refuse connections to anywhere except this site and the anonymous analytics endpoint. A coding mistake could not quietly send your data elsewhere, because the browser itself would block the request.
2regex is a free regular expression workbench that runs entirely in your web browser. A regular expression, or regex, is a compact pattern that describes text, and developers use one to validate input, extract values, and rewrite strings.
2regex shows what a pattern really does against your own text. Every match is highlighted as you type, capture groups appear in their own colors, and each token of the pattern can be read in plain English. Matching uses the native JavaScript engine in your browser, so a result here is the result your JavaScript code will get in that browser.
Regex testing works best on real text, and real text often means production logs, customer records, or access tokens. Many online testers send what you paste to a server, and some offer save features that create public links. Zero retention means a tool has nothing to leak because it never receives your data.
2regex has no accounts, no pattern database, and no share links. Your text exists only in the memory of this browser tab, and it is gone when you close the tab. The only values remembered between visits are your theme and your active tab.
$1 and named references such as $<year>. Each reference is checked, so a typo is flagged before it reaches your code.new RegExp call, with escaping handled for you.g, which finds every match rather than only the first.^ and $ match at each line.\p{L}.Catastrophic backtracking is a failure where a regex engine tries an exploding number of ways to divide up the same text. A pattern such as (a+)+$ can take years to fail on a string of a few dozen letters, because each extra character roughly doubles the work.
2regex runs matching in a background worker and stops it after about one second, then shows a Timed out status. The page never freezes. To fix a slow pattern, remove quantifiers nested inside other quantifiers, and make each alternative start differently.
A capture group is a part of a pattern wrapped in parentheses, and it saves the text it matched. The pattern (\d{4})-(\d{2}) captures a year and a month separately. A named group, written (?<year>\d{4}), gives that value a label your code can read.
A non-capturing group, written (?:...), groups parts without saving anything. Non-capturing groups are useful for applying a quantifier or alternation while keeping the numbering of your real captures unchanged.
A greedy quantifier takes as much text as it can while still allowing the overall match to succeed. A lazy quantifier, written with a trailing question mark, takes as little as it can. Against <b>bold</b>, the greedy <.*> matches the whole string, while the lazy <.*?> matches each tag separately.
A negated character class such as <[^>]*> is often better than either choice, because it states exactly where the match must stop and avoids unnecessary backtracking.
Lookahead and lookbehind are zero-width assertions, which check the text around a position without including it in the match. The pattern \d+(?=px) matches digits only when px follows, and (?<=\$)\d+ matches digits only when a dollar sign comes before them.
Negative forms, (?!...) and (?<!...), require that the text does not appear. Because lookaround consumes nothing, several checks can be stacked at one position, which is how password rules are usually written.
\...* where a negated class would state the boundary precisely.m flag when ^ and $ should apply to each line.u flag on text with emoji, which splits them into two halves.Most core syntax is shared across languages, but the details differ. Python writes named groups as (?P<name>...), where JavaScript uses (?<name>...). Go uses the RE2 engine, which has no backreferences or lookaround and in exchange cannot backtrack catastrophically. PCRE, used by PHP, adds recursion and conditionals that JavaScript lacks.
2regex tests JavaScript behavior only, so a pattern headed for another language should be checked in that language as well.
Part of the 2suite.io privacy-first ecosystem. Working with JSON instead? 2json is the matching workbench for JSON documents.
Yes. Every tool is free, with no account, no usage limits, and no paid tier.
No. All matching runs in your browser, so your text never leaves this browser. Patterns and test text are not uploaded or stored, and only your theme and active tab are remembered between visits.
Yes, one anonymous page-view count when the page loads, before you can type anything. It records the app name, the event name, and a random ID for that browser tab. If you submit the feedback form, your vote, your comment, and your browser type are sent too. Your patterns and test text are never included.
2regex uses the native JavaScript RegExp engine in your browser, so results match what your JavaScript code will do in that browser. Very new syntax depends on your browser version. Other languages, such as Python or Go, can behave differently.
Matching runs in a background worker that is stopped after about one second. The page stays responsive and shows a Timed out status, which usually points to catastrophic backtracking from nested quantifiers.
A caret marks a zero-length match, which matches a position and consumes no characters. Patterns such as a* or a lookahead on its own can produce them. They are real matches, so they are included in the count.
You can save patterns for the current session and export them to a JSON file, which you can import later. There are no share links, because a share link would require storing your data somewhere or putting it in a URL.
The match count is always complete. To keep the page responsive, the first 5,000 matches are highlighted and the first 1,000 are listed in the table, and the page tells you when that limit applies.