Regex Tester & Debugger

Live regular expression testing with match highlighting and group capture

What is Regular Expression (Regex)?

A regular expression (regex) is a sequence of characters that defines a search pattern. Regex is used for:

  • Pattern matching: Find text that matches specific patterns (emails, phone numbers, URLs)
  • Validation: Verify input formats (passwords, credit cards, dates)
  • Search and replace: Find and modify text in documents or code
  • Data extraction: Pull specific information from logs, HTML, or datasets
  • Security: Detect malicious patterns, filter input, prevent injection attacks

Used in programming languages (JavaScript, Python, PHP, Java), text editors, command line tools (grep, sed), and security tools.

Regex Cheatsheet
.

Any character except newline

\d

Digit (0-9)

\w

Word character (a-z, A-Z, 0-9, _)

\s

Whitespace (space, tab, newline)

^

Start of string/line

$

End of string/line

*

0 or more repetitions

+

1 or more repetitions

?

0 or 1 (optional)

{n,m}

Between n and m repetitions

[abc]

Character class (a, b, or c)

(group)

Capture group

a|b

Alternation (a or b)

\b

Word boundary

(?=...)

Positive lookahead

(?!...)

Negative lookahead