Regex Tester
Test JavaScript regular expressions in an isolated worker with a 250 ms timeout and readable match positions.
Loading tool…
How to use Regex Tester
Check a JavaScript regular expression against sample text. A dedicated worker keeps expensive patterns away from the page, and the worker is terminated after each run.
- Enter a JavaScript regex pattern without slash delimiters.
- Choose flags and provide sample text.
- Run the test to inspect match text, character indices, and capture groups.
Good to know
- Worker loading has a separate 10-second limit. The 250 ms pattern-processing limit starts only after the worker reports that it is ready.
- Up to 1,000 pattern characters, 50,000 sample characters, and 200 displayed matches. Long matches and groups are abbreviated.
- JavaScript regex syntax differs from PCRE, Python, and other engines. Indices are UTF-16 code-unit offsets.
Extract letter-number codes with two capture groups
Enter the pattern without slash delimiters, set Flags to g, and paste the sample text. Parentheses capture the letter prefix and numeric suffix separately. The g flag finds both codes; i alone reports the first match. Empty Flags defaults to g. Match positions are zero-based UTF-16 offsets, with an exclusive end position. They identify locations in the supplied JavaScript string, not byte positions in a file. Use this small example to confirm your capture groups before testing a longer log or changing the expression.
Pattern, flags and sample text
Pattern: ([A-Z]+)-(\d+) Flags: g Sample: AB-12 CD-7
Expected match report
Match 1: index 0, end 5 "AB-12" Capture groups: 1: "AB", 2: "12" Match 2: index 6, end 10 "CD-7" Capture groups: 1: "CD", 2: "7"
- This is JavaScript RegExp syntax. Supported flags are g, i, m, s and u, each at most once; Python and PCRE expressions may differ.
- The Worker has a separate 10-second loading deadline, then a 250 ms computation limit. Reports stop at 200 matches and abbreviate long captures.
Common questions
Can a difficult pattern freeze the page?
The pattern runs in a separate worker that is terminated if the safety timeout is reached.
What happens with an empty match?
The tester advances by one code point in Unicode mode, or one code unit otherwise, so global empty matches terminate.
Keep going with related tools
All developer →Text Diff
Compare two texts line by line and download an easy-to-read difference report, entirely in your browser.
TextFind & Replace
Replace literal text once or everywhere, with case-sensitive matching and no regular-expression execution.
DeveloperJSON Validator
Check JSON syntax locally and see its root type, value count, and nesting depth.
EducationExplicit Epsilon-NFA Workbench
Simulate finite token strings or build a reachable deterministic transition table from a supplied epsilon-NFA.
DataUser-supplied DNA Recognition Motif Finder
Find declared IUPAC DNA motifs on both strands with exact coordinates and explicit ambiguity semantics.
EducationBoolean Truth Table Workbench
Enumerate bounded propositional truth tables and find real counterexamples to formula equivalence.