regex-tester.ts × README.md package.json Ln 1, Col 1

Regex Tester

Test and debug regular expressions with real-time match highlighting.

@ local-runtime @ typescript @ 0 deps
$ ./regex-tester ▶ running
// docs / regex-tester.md

What is a Regular Expression?

A regular expression (regex) is a sequence of characters that defines a search pattern. Regex is used to find, match, and manipulate text in programming, data validation, log analysis, and search-and-replace operations.

How to Use This Tool

  1. Enter your regex pattern in the pattern field.
  2. Set flags (g for global, i for case-insensitive, m for multiline).
  3. Paste your test string below.
  4. Matches are highlighted in real time.

Common Regex Patterns

Email validation: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}

URL matching: https?://[^\s]+

Phone number: \+?[\d\s\-()]{7,15}

Tips

  • Use anchors (^ and $) to match start and end of string.
  • Use \d for digits, \w for word characters, \s for whitespace.
  • Quantifiers: * (0 or more), + (1 or more), ? (0 or 1), {n,m} (between n and m).

// faq

What regex flavor does this tool use? +

This tool uses JavaScript (ECMAScript) regex, which is compatible with most modern programming languages.

How do I match a literal dot? +

Escape it with a backslash: \. A plain dot in regex matches any character except newline.

main ⚡ 6 tools Ln 1, Col 1 UTF-8 LF TypeScript