🔍

Regex Tester

Test regular expressions with live match highlighting and group extraction.

100% in-browser — no data sent anywhere
Regular Expression
/ /
Flags
gglobal
icase-insensitive
mmultiline
sdotAll
uunicode
Test String
0 chars
Match Results

Common Patterns

Regex Quick Reference

PatternDescription
.Any character except newline
\d \DDigit / Non-digit
\w \WWord character / Non-word character
\s \SWhitespace / Non-whitespace
\b \BWord boundary / Non-word boundary
^ $Start / End of string (or line with m flag)
[abc]Character class — matches a, b, or c
[^abc]Negated class — not a, b, or c
a|bAlternation — a or b
(abc)Capturing group
(?:abc)Non-capturing group
(?<name>abc)Named capturing group
a? a* a+0 or 1 / 0 or more / 1 or more
a{3} a{2,5}Exactly 3 / Between 2 and 5
a*? a+?Lazy quantifiers (match as few as possible)
(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind
(?<!abc)Negative lookbehind

What are Regular Expressions?

Regular expressions (regex or regexp) are patterns used to match character combinations in strings. They are one of the most powerful text-processing tools available and are supported by virtually every programming language.

A regex pattern describes a set of strings using a compact syntax of literal characters, character classes, quantifiers, and grouping constructs. The engine then searches through input text to find substrings that match the pattern.

Flags modify how the pattern is applied: g (global) finds all matches, i makes matching case-insensitive, m (multiline) makes ^ and $ match line boundaries, s (dotAll) makes . match newlines, and u (unicode) enables full Unicode matching.

Common uses

Form Validation
Validate emails, phone numbers, URLs, postcodes, and other user input formats.
🔎
Search & Replace
Find and transform text patterns in code editors, logs, and documents.
📊
Log Parsing
Extract timestamps, IPs, error codes, and structured fields from log files.
🧹
Data Cleaning
Strip unwanted characters, normalise formats, and sanitise input data.
🕸️
Web Scraping
Extract data from HTML, CSV, and other semi-structured text sources.
🛡️
Security Rules
Define WAF rules, input filters, and content policies with regex patterns.

Explore More Tools