Regex Tester

Test regular expressions online with real-time matching and highlighting. Free regex debugger tool.

/ /

About Regex Tester

Test and debug your regular expressions in real time. See matches highlighted in your text, with match groups and indices displayed.

Video Tutorial

3:05

Video coming soon — full transcript available below

Chapters

Full transcript searchable
0:00

What regex testers are for

Welcome to this Regex Tester tutorial. Regular expressions are powerful patterns for searching, validating, and extracting text. But writing regex from scratch is error-prone — a single misplaced character can break the entire pattern. A regex tester lets you iterate quickly: write a pattern, see what it matches, refine, and repeat. Without a live tester, you'd need to write code, run it, check output, edit, repeat — a slow cycle. With the Regex Tester on ToolPilot.dev, feedback is instant.

0:25

Enter pattern and test string

Open the Regex Tester on ToolPilot.dev. You'll see two inputs: the pattern field at the top and the test string area below. Enter your regular expression in the pattern field — don't include the surrounding slashes, just the pattern itself. In the test string area, paste the text you want to match against. The tool immediately evaluates your pattern and shows results. Try a simple pattern like \d+ to match sequences of digits.

0:55

Real-time match highlighting

As you type, matching text highlights in the test string area in real time. Each match gets highlighted so you can see exactly what the pattern catches. If the pattern matches nothing, the test string stays unhighlighted. The match count shows how many matches were found. You can also see capture group contents — when your pattern uses parentheses for groups, the captured values display separately. This visual feedback makes it easy to verify complex patterns work correctly.

1:30

Using flags: global, case-insensitive, multiline

Regex flags change how matching works. The global flag (g) finds all matches instead of stopping at the first one. The case-insensitive flag (i) makes the pattern match regardless of capitalization. The multiline flag (m) makes the caret and dollar sign match at line boundaries instead of just the start and end of the string. The Regex Tester has toggle buttons for these common flags. Enable global to see all matches highlighted simultaneously.

2:05

Use case: email validation regex

One of the most common regex use cases is validating email addresses. A practical email regex pattern is: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}. Test it against valid emails like [email protected] and invalid strings like notanemail or @missing.com. The tester immediately shows you which strings match. You can refine the pattern to handle edge cases like plus addressing ([email protected]) or subdomain addresses.

2:35

Use case: log file parsing

Server log files are a prime use case for regex. To extract IP addresses from Apache logs, use: \b(?:\d{1,3}\.){3}\d{1,3}\b. To match HTTP status codes, use: HTTP/\d\.\d (\d{3}). To extract timestamps, use patterns matching your specific log format. Paste a few lines from your log file into the test string, write the extraction pattern, and verify it captures exactly the data you need before using it in a script.

2:55

Wrap-up

The Regex Tester on ToolPilot.dev helps you build and validate regular expressions quickly without writing code. It supports all standard JavaScript regex syntax including lookaheads, lookbehinds, named groups, and Unicode patterns. All matching runs in your browser using the JavaScript regex engine. Visit ToolPilot.dev for this and 19 other free developer tools.

Transcript covers all 7 chapters (3:05 total).

Frequently Asked Questions

What is a regular expression (regex)?
A regular expression is a sequence of characters that defines a search pattern. It is used for pattern matching in text — finding, extracting, replacing, or validating strings that match specific criteria.
What regex syntax does this tester use?
The Regex Tester uses JavaScript regex syntax, which follows the ECMA-262 standard. It supports common patterns like \d (digit), \w (word character), \s (whitespace), quantifiers (*, +, ?, {}), anchors (^, $), and character classes ([a-z]).
What do the regex flags g, i, m mean?
Flag 'g' (global) finds all matches instead of stopping at the first. Flag 'i' makes matching case-insensitive. Flag 'm' (multiline) makes ^ and $ match the start/end of each line, not just the whole string.
How do I match an email address with regex?
A common email regex pattern is: ^[\w.-]+@[\w.-]+\.[a-z]{2,}$. Paste this pattern in the Regex Tester and test it against your email strings to see which ones match.
How do I match a URL with regex?
A basic URL pattern: https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*). Use the Regex Tester to verify it matches your target URLs.
What is a capture group in regex?
A capture group is a section of the pattern enclosed in parentheses (). It extracts specific parts of a match. For example, (\d{4})-(\d{2})-(\d{2}) matches a date and captures year, month, and day as separate groups.
What is the difference between greedy and lazy matching?
Greedy quantifiers (*, +, {n,}) match as much text as possible. Lazy quantifiers (*?, +?, {n,}?) match as little as possible. Example: <.+> greedily matches an entire line of HTML; <.+?> lazily matches individual tags.
How do I match a phone number with regex?
A flexible US phone number regex: ^\+?1?\s?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$. Test it in the Regex Tester against formats like (555) 123-4567, 555-123-4567, and +15551234567.
Can I use regex to validate an IP address?
Yes. An IPv4 validation regex: ^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$. Paste it in the Regex Tester to check your IP strings.
How do I test regex in Python?
Use the re module: import re; match = re.search(r'pattern', text). Use re.findall() to get all matches. Test your pattern first in the browser-based Regex Tester before integrating it into your Python code.

Code Examples

Ready-to-use implementations in popular programming languages. Copy, paste, and run.

Regex Matching in JavaScript
// Test if a string matches a pattern
const emailPattern = /^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,}$/;
console.log(emailPattern.test('[email protected]')); // true

// Extract all matches from a string
const text = 'Call 555-1234 or 555-5678';
const phones = text.match(/\d{3}-\d{4}/g);
console.log(phones); // ['555-1234', '555-5678']

// Replace with regex
const cleaned = 'Hello   World'.replace(/\s+/g, ' ');
console.log(cleaned); // 'Hello World'

Related Workflow Guides

Compare with alternatives