Regex Tester
Tool guideTest regular expressions with live matching
Input: This tool processes input in your browser. Check in Network (opens in a new tab)
//
Mode:
Test String
Matches
Matches will appear here
Tool guide
Back to workspaceTest your regular expressions instantly with live matching highlights, capture group visualization, and individual flag toggles (g, i, m, s, u, y). Built-in 100ms timeout prevents ReDoS attacks. All processing runs in your browser.
How to use it
- Paste the sample labels into the test string editor and the expression into the field between the two slash marks, without typing the slashes.
- Choose Whole mode, enable only g and m, and select Test. Check that the shortened label on the middle line does not appear in the matches.
- Turn off m and run again. In Whole mode, the anchors now refer to the full text rather than each line, so this three-line input produces no matches.
Worked example
- Test string
NW-007 NW-7 SE-042- Pattern
^(?<bay>[A-Z]{2})-(?<slot>\d{3})$- Example output
Match 1: "NW-007" (0–6) Group 1: "NW" Group 2: "007" bay: "NW" slot: "007" Match 2: "SE-042" (12–18) Group 1: "SE" Group 2: "042" bay: "SE" slot: "042" Total: 2 match(es)
The second match starts at offset 12 in the full text and ends before offset 18. The captured slot is text, so 007 retains its leading zeros.
What to watch for
The tester uses JavaScript regex syntax, not your database or editor’s regex dialect. In Whole mode, turning off g reports only the first match even when more lines qualify.
Frequently asked question
- Why would I use Per-Line instead of Whole with m?
- Per-Line runs the pattern separately on each nonblank line and reports failures alongside matches. Its offsets start at zero within each tested line, not within the whole input.