Embed this tool on your site
<iframe src="https://devtoolbox.dedyn.io/tools/regex-builder" width="100%" height="800" frameborder="0" title="Regex Pattern Builder"></iframe>

Regex Pattern Builder

Build, test, and debug regular expressions visually. Real-time match highlighting, pattern explanation, and code export. Everything runs in your browser.

/ / g
Type a pattern and test string above...
No matches yet.
Regex Quick Reference

Character Classes

. Any character (except newline)
\d Digit [0-9]
\D Non-digit
\w Word char [a-zA-Z0-9_]
\W Non-word char
\s Whitespace
\S Non-whitespace
[abc] Character set
[^abc] Negated set

Quantifiers

* 0 or more
+ 1 or more
? 0 or 1
{n} Exactly n
{n,} n or more
{n,m} Between n and m
*? Lazy 0 or more
+? Lazy 1 or more

Anchors & Boundaries

^ Start of string/line
$ End of string/line
\b Word boundary
\B Non-word boundary

Groups

(abc) Capturing group
(?:abc) Non-capturing
(?<name>abc) Named group
a|b Alternation

Lookaround

(?=abc) Positive lookahead
(?!abc) Negative lookahead
(?<=abc) Positive lookbehind
(?<!abc) Negative lookbehind

Frequently Asked Questions

What is a regular expression (regex)?
A regular expression is a sequence of characters that defines a search pattern. Regex is used for string matching, validation, search-and-replace, and text extraction in virtually every programming language.
What do regex flags like g, i, and m mean?
The 'g' (global) flag finds all matches instead of just the first. The 'i' flag makes matching case-insensitive. The 'm' (multiline) flag makes ^ and $ match the start/end of each line rather than the entire string. The 's' (dotall) flag makes . match newline characters. The 'u' (unicode) flag enables full Unicode matching.
How do capturing groups work in regex?
Capturing groups are created with parentheses (). They capture the matched text so you can reference it later. For example, (\d{3})-(\d{4}) would capture the area code and number separately. Named groups use (?<name>...) syntax. Non-capturing groups (?:...) group without capturing.
What is the difference between greedy and lazy quantifiers?
Greedy quantifiers (*, +, {n,m}) match as much text as possible, while lazy quantifiers (*?, +?, {n,m}?) match as little as possible. For example, given '<b>bold</b>', the greedy pattern <.*> matches the entire string, while <.*?> matches just '<b>' and '</b>' separately.
How do lookahead and lookbehind assertions work?
Lookahead (?=...) and lookbehind (?<=...) are zero-width assertions that check for patterns without including them in the match. Positive lookahead (?=...) asserts what follows, negative lookahead (?!...) asserts what must not follow. Similarly, (?<=...) and (?<!...) work for lookbehind.
Can I use this regex builder offline?
Yes! DevToolbox is a Progressive Web App. Once you visit the page, it is cached by the service worker and works fully offline. All regex processing happens in your browser using JavaScript's built-in RegExp engine -- no data is sent to any server.
Keyboard Shortcuts
Ctrl+Enter Test pattern
Ctrl+Shift+C Copy regex
Ctrl+L Clear