PATTERN LAB

Regex Builder

Generate and test regular expressions with common templates.

Matches

No matches yet

Matched segments will appear here.

Regex Builder Help, Examples, and FAQ

Use the regex tester to run a JavaScript regular expression against sample text and inspect every match immediately. Start with positive, negative, and boundary examples, then adjust one token or flag at a time. Browser results follow JavaScript RegExp behavior and may differ from PCRE, RE2, or server-side engines.

How to use it

Choose a starter template or enter a JavaScript pattern, add only the flags you need, and paste representative text. Compare expected matches with the result, then change one group, quantifier, boundary, or flag at a time.

Worked example

Input
Pattern: \b[A-Z]{2}-\d{4}\b
Text: Order AB-2048, draft A-12
Output
1 match: AB-2048

Useful scenarios

  • Validate email input with samples containing plus signs, subdomains, and long top-level domains.
  • Extract request IDs, IP addresses, or status codes from logs while ensuring each line matches only the target field.
  • Design keyword filtering rules and test case sensitivity, whitespace, and special characters.

Supported behavior and limits

  • Uses the browser JavaScript RegExp engine and supports native flags such as g, i, m, s, u, and y when available.
  • All matches are collected with global matching; invalid patterns or flags return an inline syntax error.
  • No fixed text limit is enforced. Complex nested quantifiers can still cause slow execution on long input.

Privacy and data handling

Patterns and test text remain in the browser. Test untrusted patterns against realistic long samples before production use.

Frequently asked questions

  • Why does it match too much? Missing anchors, missing boundaries, or a broad .* are common causes.
  • Why is production different? Regex engines and supported flags differ across languages.
  • When should I avoid regex? Prefer structured parsers for JSON, URLs, HTML, CSV, and other well-defined formats.
Content maintained by GoTools EngineeringThis update added an example, supported limits, privacy details, and references.
Regex Builder and Tester for Pattern Matching | GoTools