Start getting better AI results today

Regex Tester & Generator

Test regular expressions with live matching or generate regex patterns for common use cases like emails, URLs, and AWS WAF rules.

Available Flags:

g- Global
i- Case-insensitive
m- Multiline
s- DotAll
u- Unicode
y- Sticky

Regex syntax reference

Character classes

\dAny digit (0-9)
\wAny word character (letter, digit, underscore)
\sAny whitespace character
.Any character except newline
[abc]Any one of a, b, or c
[^abc]Any character except a, b, or c

Anchors

^Start of string (or line, with the m flag)
$End of string (or line, with the m flag)
\bWord boundary

Quantifiers

*0 or more
+1 or more
?0 or 1 (also makes quantifiers lazy: *?, +?)
{n,m}Between n and m times

Groups & lookarounds

(...)Capturing group
(?:...)Non-capturing group
(?=...)Positive lookahead
(?!...)Negative lookahead

Common regex mistakes

Greedy quantifiers matching too much

.* grabs as much as possible. Use .*? (lazy) when you want the shortest match instead, e.g. extracting text between two specific tags.

Forgetting to escape special characters

Characters like . * + ? ( ) [ ] { } | \ have special meaning. To match a literal period, use \. not .

Not anchoring the pattern

Without ^ and $, a pattern can match anywhere in the string — /\d{3}/ matches inside "abc123def" too. Anchor it if you need to validate the whole string.

Mixing up capturing and non-capturing groups

If you don't need to reference a group's contents later, use (?:...) — capturing groups you never use just add overhead and clutter match results.

Advertisement (728×90)

How it works

1.

Choose Mode

Test existing regex or generate new patterns.

2.

Enter Pattern/Text

Type your regex or select a pattern to generate.

3.

Test & Validate

See matches in real-time with flag explanations.

Common use cases

Email Validation

Test regex patterns for email validation.

AWS WAF Rules

Generate regex for AWS WAF to match specific hosts or URL paths.

Data Extraction

Extract specific patterns from text or logs.

String Replacement

Test patterns before using in code.

Frequently asked questions

What are regex flags?

Flags modify regex behavior: g (global - find all matches), i (case-insensitive), m (multiline - ^ and $ match line boundaries), s (dotAll - . matches newlines), u (unicode), y (sticky - match from lastIndex).

How do I use this for AWS WAF?

Generate a pattern (like URL or custom), then use it in AWS WAF regex pattern sets. For host-only matching, use patterns like ^example\.com$ in the Host header condition.

Do I need to escape special characters?

Yes. Characters like . * + ? ^ $ { } ( ) | [ ] \ need to be escaped with backslash (\).

Is my data stored?

No. All testing happens in your browser.

Share this tool

Start getting better AI results today