Regex Tester

Test regex online and generate starter regex from plain-English descriptions.

What this tool does

Use this Regex Tester to validate patterns against sample text, inspect matches, and review capture groups. The built-in Regex Generator helps you convert plain-English requests like 'match email addresses' or 'extract 6 digit order numbers' into practical starter patterns. It is designed for developers, analysts, and QA teams who need fast regex checks before shipping filters, validations, and parsing logic. Paste sample text, run the pattern, and verify exactly what matches before using it in code, ETL rules, or spreadsheet cleanup workflows.

Tool interface

Regex Tester + Generator

Test regex online and generate starter regex from plain-English descriptions.

Generate Regex from Plain English

Describe the pattern you want to match and we'll generate a starter regex. You can immediately test and refine it in the regex tester below.

Example prompts

Tip: Generated regex patterns are starting points. You can refine and test them using the regex tester below.

Regex Tester

Choose a preset, test your pattern against realistic sample text, and verify match groups before using it in code.

Quick presets

When to use flags

g: find all matches, not only the first.

i: case-insensitive matching.

m: ^ and $ match each line boundary.

s: dot . also matches line breaks.

u: use Unicode-aware matching.

y: sticky matching from the current position only.

Common Regex Patterns

Email address

\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b

Matches standard email address formats in text blocks.

URL

https?:\/\/[\w.-]+(?:\/[\w\-./?%&=+#]*)?

Matches HTTP and HTTPS URLs including path and query fragments.

IPv4 address

\b(?:25[0-5]|2[0-4]\d|1?\d?\d)(?:\.(?:25[0-5]|2[0-4]\d|1?\d?\d)){3}\b

Matches IPv4 addresses while constraining each octet to 0-255.

Hex color

#(?:[A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})\b

Captures 3, 6, and 8-character hexadecimal color values.

DD/MM/YYYY date

\b(?:0[1-9]|[12]\d|3[01])\/(?:0[1-9]|1[0-2])\/\d{4}\b

Matches dates in day/month/year format with basic date-range checks.

6-digit code

\b\d{6}\b

Extracts standalone six-digit codes like OTPs or order references.

Whitespace cleanup

{2,}

Finds repeated spaces so text can be normalized.

Username pattern

^[A-Za-z0-9_]{3,30}$

Validates usernames 3-30 chars using letters, numbers, and underscores.

Example input

Description: Match email addresses

Pattern: [A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}
Flags: g
Sample text: Contact ana@example.com and team@company.io.

Example output

Generated regex: /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g
Match count: 2
Matches:
1. ana@example.com
2. team@company.io

Step-by-step instructions

  1. Start in Generate Regex, describe what you want to match, and click Generate Regex.
  2. Use Use in Tester to send the suggested pattern and flags into the tester.
  3. Paste representative sample text, run Test Regex, and review matches, indexes, and capture groups.
  4. Adjust the pattern or flags (`g`, `i`, `m`) until the highlighted matches are correct.

Common use cases

  • Validating extraction patterns before shipping code.
  • Debugging mismatched filters in parsing pipelines.
  • Comparing pattern behavior across sample input variations.

Helps you move from plain-language matching goals to tested regex patterns you can trust in production code and data pipelines.

Common mistakes to avoid

  • Testing with sample text that is too clean and does not represent real production data.
  • Forgetting to enable `g` when you expect all matches instead of the first match.
  • Using unescaped characters like `.` or `+` when you intended literal text.
  • Assuming generated patterns handle nested or highly specific formats without review.

Frequently Asked Questions

Can Regex Tester + Generator run patterns with flags?

Yes. Enter flags like `g`, `i`, or `m` in the flags field to control global, case-insensitive, and multiline matching.

How accurate is the regex generator?

It uses deterministic heuristics for common intents. Treat suggestions as a starting point and validate against real sample text.

What is a regex tester?

A regex tester lets you run a regular expression against sample text and inspect exactly what matches before using the pattern in code.

Can I generate regex from plain English?

Yes. Enter a request like 'extract 6 digit order numbers' and the generator suggests a regex pattern, flags, and explanation.

What do regex flags like g, i, and m mean?

`g` finds all matches, `i` makes matching case-insensitive, and `m` lets `^` and `$` work per line in multiline text.

Why is my regex not matching?

Common causes are missing escapes, wrong flags, anchors in the wrong place, or sample text that differs from your real input format.

Can I test capture groups in this tool?

Yes. Match output includes capture-group values when your pattern contains grouped subexpressions.

Is this regex tester and generator free?

Yes. It is free to use with no signup required.

Related tools

Related guides

Browse all DataToolbox guides for more workflows.

Related categories

Looking for other utilities in this area? Developer Data Tools