fixmint
EN

Test and debug a regular expression

See each match, group and replacement as you type, with the pattern explained in plain English.

  • Runs on your device
  • No sign-up
  • Works offline after a visit
Flags

In a replacement, $1 is group 1, $<name> a named group and $& the whole match.

0 matches
Matches in your text
Text after replacing

How the pattern reads

Code


    

How to test a regular expression

  1. Type the pattern and tick its flags.
  2. Paste the text you want to match against.
  3. Read the matches and the explanation, or copy the code for your language.

Questions

Is my text uploaded?

No. The pattern is compiled and run inside your browser, in a background worker. Nothing is sent to a server.

Why does the tester say a pattern takes too long?

Some patterns backtrack exponentially on text that almost matches, such as (a+)+$ on a long run of a. The tester stops a run after one second. Simplify the repeat, for example a+ instead of (a+)+.

Do JavaScript, Python and PHP differ?

Yes, in details. Python writes named groups as (?P<name>...) and has no \p{...} without a third-party module. PHP wraps the pattern in / delimiters and needs the u flag for Unicode matching. The code tabs show each change.

What do $1, $<name> and $& mean in a replacement?

$1 is the text of the first group, $<name> the text of a named group and $& the whole match. Each language writes the same replacement its own way.

Reviews

    No reviews yet. Be the first.

    Your rating

    Your email is never shown or kept.

    Read more