Regular Expression Tester

Test a JavaScript regular expression, flags and capture groups entirely in the browser.

Calculator Encoders & Utilities Runs in your browser

Result

Matches
2
Pattern
/\b(?<octet>\d{1,3})(?:\.\d{1,3}){3}\b/gi
#MatchIndexCapture groups
1192.168.1.181: 192
210.0.0.254421: 10

About Regular Expression Tester

Compile and run JavaScript regular expressions locally, with match offsets and capture-group output. The tester adds global matching internally so repeated matches can be listed without altering the requested flags.

Engine compatibility

The browser JavaScript engine defines supported syntax, Unicode behaviour and capture semantics. A pattern copied from PCRE, RE2 or .NET may need changes even when it looks similar.

Designing reliable patterns

Prefer explicit boundaries and constrained character classes over broad wildcards. Test valid, invalid and adversarial samples, including empty strings and very long lines. A regex that extracts an address does not prove the address is valid; follow matching with domain validation. For untrusted large input, avoid nested ambiguous repetition because backtracking can consume significant CPU and make an otherwise simple browser tool or production service unresponsive.

Common use cases

  • Extract addresses or identifiers from logs.
  • Verify capture groups before writing a parser.
  • Test case sensitivity and multiline behaviour.

Edge cases and gotchas

  • JavaScript regex syntax differs from PCRE, RE2 and .NET.
  • Catastrophic backtracking can freeze a browser tab; avoid ambiguous nested quantifiers on large input.
  • Benchmark the final pattern with realistic and adversarial data in the target runtime. Browser success does not establish acceptable latency or denial-of-service resistance in a production parser.

Frequently asked questions

Why is output limited to 1,000 matches?
The cap keeps accidental broad patterns from producing an unbounded page of results. Narrow the pattern or test a smaller representative sample when the limit is reached, then validate performance separately with production-sized input.
Does a match prove the value is valid?
No. Regex identifies text shape. Apply semantic validation afterwards for addresses, dates, identifiers, protocol fields and any security-sensitive input.