Calculator Need
Categories

Regex Tester

Test a regular expression with highlighted matches and groups.

Highlighted matches

Matches will be highlighted here.

Cheatsheet

PatternMeaning
.Any character except newline
\d \w \sDigit, word character, whitespace
\D \W \SNot a digit, word character, whitespace
[abc] [^abc] [a-z]Character class, negated class, range
^ $ \bStart, end, word boundary
* + ? {n} {n,m}Zero or more, one or more, optional, exact, range
( ) (?: ) (?<name> )Capturing group, non-capturing group, named group
|Alternation (or)
(?= ) (?! )Positive / negative lookahead

Runs entirely in your browser. Nothing you paste or upload leaves your device.

How to use the regex tester

  1. Type your regular expression into the Pattern box.
  2. Type or paste the text to test.
  3. Press “Test” to see the matches highlighted, with the groups listed.

Regex tester example

Pattern \b03\d{2}-?\d{7}\b with the g flag matches Pakistani mobile numbers written as 0300-1234567 or 03001234567.

Common building blocks

  • \d digit, \w word character, \s whitespace, . any character.
  • + one or more, * zero or more, ? optional, {3} exactly three.
  • ^ start, $ end, ( ) capture group, | or.

Tips for using the regex tester

  • Test against examples that should not match, too.
  • Escape special characters (. * + ? ( ) [ ] { } \ | ^ $) with a backslash to match them literally.

Regex tester: common questions

What is a regular expression?
A pattern for finding text — for example, \d+ finds numbers and [A-Z]+ finds capital letters.
What do the flags do?
g finds every match instead of the first, i ignores upper and lower case, m treats each line separately, s lets . match new lines, u turns on Unicode, and y anchors the match at one position.
Why does my pattern show no matches?
Check for a missing escape (such as \. for a real dot) or a flag you need. The sample pattern is a working example to start from.
Is my pattern or text uploaded?
No. Testing runs in your browser.
Which regex flavour is used?
JavaScript (ECMAScript), the same as in browsers and Node.js. Most simple patterns work the same in Python, PHP and Java.