Regex Tester

Regex Pattern
JSPCRE
//

Match Result

No match

Character Classes

SyntaxMeaningJSPCREPythonJava
\dDigit [0-9]
\DNon-digit [^0-9]
\wWord character [a-zA-Z0-9_]
\WNon-word character
\sWhitespace
\SNon-whitespace
.Any character (except newline)
[abc]Character class (match a/b/c)
[^abc]Negated class (not a/b/c)
[[:alpha:]]POSIX alpha class
[[:digit:]]POSIX digit class
\p{L}Unicode letter⚠️
\p{N}Unicode number⚠️
\XUnicode extended grapheme cluster

Quantifiers

SyntaxMeaningJSPCREPythonJava
*Zero or more
+One or more
?Zero or one
{n}Exactly n times
{n,m}Between n and m times
*?Zero or more (lazy)
+?One or more (lazy)
??Zero or one (lazy)
{n,m}?Between n and m (lazy)
*+Zero or more (possessive)
++One or more (possessive)
?+Zero or one (possessive)

Anchors

SyntaxMeaningJSPCREPythonJava
^Start of string (line start in multiline)
$End of string (line end in multiline)
\bWord boundary
\BNon-word boundary
\AAbsolute start of string
\ZAbsolute end of string (before newline)
\zVery end of string (after newline)
\GEnd of previous match

Groups & References

SyntaxMeaningJSPCREPythonJava
(...)Capturing group
(?:...)Non-capturing group
(?<name>...)Named group (JS/Java style)⚠️
(?P<name>...)Named group (Python style)
\1Backreference to group N
$1Replacement ref to group N
\k<name>Named backreference
(?|...)Branch reset group
(?>...)Atomic group (no backtracking)

Lookaround

SyntaxMeaningJSPCREPythonJava
(?=...)Positive lookahead
(?!...)Negative lookahead
(?<=...)Positive lookbehind
(?<!...)Negative lookbehind

Modifiers

SyntaxMeaningJSPCREPythonJava
(?i)Case insensitive
(?-i)Case sensitive⚠️
(?m)Multiline (^/$ match line starts/ends)
(?s)Dotall (. matches newline)⚠️
(?x)Extended (ignore whitespace & # comments)
(?i:...)Inline case insensitive

Advanced PCRE

SyntaxMeaningJSPCREPythonJava
\KReset match start
(*SKIP)Skip current match
(*FAIL)Force match failure
(?(cond)yes|no)Conditional expression
(?R)Recurse entire pattern
(?1)Subroutine call to group 1

About Regex Tester

A browser-based real-time regex testing workbench

This online regex tester helps developers instantly verify match results when writing, debugging, and optimizing regular expressions. It supports JavaScript and PCRE2 engine switching, real-time match highlighting, capture group display, replacement preview, 30+ common patterns, and a syntax cheat sheet. All processing runs locally in the browser—no test data is uploaded to any server.


Features

  • Switch between JavaScript and PCRE2 engines in real time
  • Instant matching with live highlight of all matches
  • Display capture groups and named capture groups
  • Built-in replace panel with backreference support
  • 30+ common regex patterns loadable with one click
  • Complete syntax cheat sheet with JS/PCRE/Python/Java compatibility

How to Use

  1. 1Enter a regex pattern and select flags
  2. 2Type or paste the test string
  3. 3View real-time match highlights and the match details table
  4. 4Expand the replace panel to preview replacement results
  5. 5Switch to PCRE2 engine to test advanced regex syntax
  6. 6Browse the cheat sheet or pattern library for common patterns

FAQ

Is test data uploaded to a server?
No. All regex matching and replacement runs locally in your browser. Your patterns and test strings never leave your device.
What is the difference between JavaScript and PCRE2 engines?
The JavaScript engine uses the browser's native RegExp, supporting standard regex syntax. The PCRE2 engine supports advanced features like lookbehind assertions, atomic groups, recursion, subroutine calls, and possessive quantifiers. Incompatible flags are automatically converted when switching engines.
Which regex flags are supported?
The JavaScript engine supports g (global), i (case insensitive), m (multiline), s (dotall), and u (unicode). The PCRE2 engine additionally supports x (extended), A (anchored), and D (dollar end only).
Can I use the patterns from the library directly?
The pattern library provides 30+ common regex templates that load into the testing area with one click. Most patterns are simplified for quick verification and daily use; production environments may require adjustments for specific needs.
Does the replace panel support backreferences?
Yes. The JavaScript engine uses $1, $2 to reference capture groups; named groups use $. The PCRE2 engine uses \\1, \\2 or ${1}, ${2} format.
What if the PCRE2 engine fails to load?
The PCRE2 engine loads a WASM file from CDN, which may take a moment on first use. If loading fails, the tool automatically falls back to the JavaScript engine. Check your network connection and try again.

Related Tools

Online CalculatorFile Type DetectorAudio EditorPDF MergePDF CompressorPassword GeneratorWord CounterText CompareCode FormatterTimestamp ConverterUnicode ConverterFull Screen Text DisplayBase ConverterBase64 Encoder DecoderURL Encoder DecoderHTML Entity EscapeMD5 EncoderJWT Decode Verify EncodeQR Code Generator & DecoderBarcode GeneratorReal Address GeneratorBMI CalculatorUUID Generator & ParserCountry CapitalsHTTP Status Codes