🔍 Regex Tester Online

Test regular expressions against sample text with live matches, flags, capture groups, presets, and helpful pattern examples.

Free Instant results No sign-up needed

Regex Tester

Build, test, and debug regular expressions live in your browser — with match highlighting and capture groups.

Live Client-side Highlighting
Match preview
Character classes
.Any character except newline
\dDigit [0–9]
\DNon-digit
\wWord [a-zA-Z0-9_]
\WNon-word
\sWhitespace
\SNon-whitespace
[abc]Character set
[^abc]Negated set
[a-z]Range
Quantifiers
*0 or more (greedy)
+1 or more (greedy)
?0 or 1 (optional)
{n}Exactly n times
{n,m}Between n and m
+?1 or more (lazy)
*?0 or more (lazy)
Anchors & boundaries
^Start of string/line
$End of string/line
\bWord boundary
\BNon-word boundary
Groups
(abc)Capture group
(?:abc)Non-capturing group
(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind
(?<!abc)Negative lookbehind
a|bAlternation (a or b)
\1Backreference to group 1
Escapes
\nNewline
\tTab
\rCarriage return
\\Literal backslash
Flags (click to toggle)
gGlobal — all matches
iCase insensitive
mMultiline (^/$)
sDot matches newline
uUnicode mode
What This Tool Does

JavaScript regex testing: Enter a pattern and sample text to test matches using the browser regular expression engine.

Supported flags: Toggle g, i, m, s, and u flags to change matching behavior.

Match details: Review highlighted matches, match positions, capture groups, named groups, presets, and a compact cheatsheet.

What is Regex?

Regex, short for regular expression, is a compact pattern syntax for matching text. Developers use it to validate input, find repeated shapes in strings, and extract useful pieces from larger text.

A regex can be as simple as matching digits with \d+ or as specific as matching a date, email-like string, URL, or log format.

What is a Regex Tester?

A regex tester lets you try a regular expression against sample text before using it in an application. This tool highlights matches, lists capture groups, shows syntax errors, and updates results as you type.

How to Use the Regex Tester

  1. Enter the regex pattern in the pattern field.
  2. Paste sample text into the test string area.
  3. Toggle supported flags: g, i, m, s, or u.
  4. Click Test or wait for live results.
  5. Review highlighted matches, positions, capture groups, and any pattern errors.

Useful Regex Concepts

  • Character classes such as [a-z] or \d match sets of characters.
  • Quantifiers such as *, +, and {2,5} control repetition.
  • Anchors such as ^ and $ match positions rather than characters.
  • Groups use parentheses to combine patterns and capture matched subtext.
  • Flags change behavior, such as global matching or case-insensitive matching.

Common Use Cases

  • Validating form fields before sending data to a backend.
  • Finding patterns in copied text, logs, or reports.
  • Extracting IDs, dates, URLs, or email-like strings.
  • Debugging a regular expression before adding it to JavaScript code.

Privacy and Processing

The pattern testing runs in your browser with JavaScript regular expressions. The sample text is not sent to a Laravel processing endpoint by this tool.

Regex Tester Online FAQ

What is regex?

Regex, short for regular expression, is a pattern language used to match, find, validate, or extract parts of text.

How do I test a regular expression?

Enter the regex pattern, paste sample text, choose any supported flags, and review the live highlighted matches and capture groups.

What do regex flags mean?

Flags change matching behavior. This tool supports g for global, i for ignore case, m for multiline, s for dot-all, and u for Unicode mode.

Why is my regex not matching?

Possible reasons include incorrect escaping, unexpected whitespace, missing flags, anchors that do not match the input, or invalid pattern syntax.

What is a capture group?

A capture group is a parenthesized part of a regex that stores the matched subtext so you can inspect or reuse it.

Related Developer Tools

Keep moving through common developer workflows with Text Compare, JSON Formatter, HTML/CSS/JS Minifier. You can also browse the full Developer Tools collection or return to the all tools hub.