Calcorithmevery number has an answer
πŸ”
All tools β†’
← Developer Tools

Regex Tester

Test regular expressions against any text in real time.

Pattern
//
Test string
Hello World! My name is Alice and I live in Amsterdam.
5 matches
HelloWorldMyAliceAmsterdam

What is a regular expression?

A regular expression (regex) is a sequence of characters that defines a search pattern. Originally developed in the 1950s by mathematician Stephen Cole Kleene, regex is now supported in virtually every programming language and text editor. It enables complex search, validation, and text transformation with concise syntax.

Essential regex syntax reference

PatternMeaningExample
.Any character except newlinea.c matches "abc", "a1c", "a c"
^Start of string^Hello matches "Hello world" but not "Say Hello"
$End of stringworld$ matches "Hello world" but not "worldwide"
*0 or more of previousab* matches "a", "ab", "abb", "abbb"
+1 or more of previousab+ matches "ab", "abb" but not "a"
?0 or 1 of previouscolou?r matches "color" and "colour"
{n,m}Between n and m repetitions[0-9]{2,4} matches 2–4 digit numbers
[abc]Character class (a, b, or c)[aeiou] matches any vowel
[^abc]Negated class (not a, b, or c)[^0-9] matches any non-digit
dAny digit [0-9]d{3}-d{4} matches phone "555-1234"
wWord character [a-zA-Z0-9_]w+ matches a single word
sWhitespace (space, tab, newline)s+ matches one or more spaces
(abc)Capturing group(d+)px captures number in "16px"
a|bAlternation (a or b)cat|dog matches "cat" or "dog"

Regex flags

/pattern/flags g β€” global: find all matches (not just first) i β€” case-insensitive: /hello/i matches "Hello", "HELLO" m β€” multiline: ^ and $ match start/end of each line s β€” dotAll: . matches newline characters too u β€” unicode: enable full Unicode matching

Common useful patterns

Email: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$/ URL: /https?://(www.)?[-a-zA-Z0-9@:%._+~#=]{2,256}.[a-z]{2,6}/ Phone (US): /^+?1?[-.s]?(?[0-9]{3})?[-.s]?[0-9]{3}[-.s]?[0-9]{4}$/ Postcode (UK): /^[A-Z]{1,2}[0-9][0-9A-Z]?s[0-9][A-Z]{2}$/ IPv4 address: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(25[0-5]|...)$/ Date (YYYY-MM-DD): /^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/

Frequently asked questions

Which regex flavor does this tester use?

It uses JavaScript (ECMAScript) regular expressions β€” the same engine that runs in browsers and Node.js.

What do the g, i and m flags mean?

g = global (find all matches, not just the first), i = case-insensitive, m = multiline (^ and $ match the start and end of each line rather than the whole string).

Is my test data private?

Yes. Matching runs entirely in your browser; neither your pattern nor your test text is sent anywhere.

Why isn’t my pattern matching anything?

Common causes are forgetting to escape special characters (. * + ? ( ) [ ]), missing the g flag when you expect multiple matches, or anchors (^ $) that don’t account for multiline input.

What this tool does

Tests a regular expression against a string of text in real time. Matched sections are highlighted in yellow. Shows all matches with their exact positions.

Input fields explained
Pattern
The regex pattern between the two slashes. Examples: \d+ for numbers, [A-Z][a-z]+ for capitalized words, \b\w{5}\b for exactly 5-letter words.
Flags
g = global (find all matches), i = case-insensitive, m = multiline (^ and $ match line starts/ends). Combine: gi for all case-insensitive matches.
Test string
The text to run the regex against. All matches are highlighted in the output area below.
πŸ’‘ Tips & context
β†’\d = digit, \w = word character, \s = whitespace, . = any character
β†’^ matches start of string, $ matches end
β†’* = 0 or more, + = 1 or more, ? = 0 or 1, {n} = exactly n times
iFormula / How it works

Flags: g=global, i=case-insensitive, m=multiline The matched parts are highlighted in yellow. Match count and positions are shown below.

Related Developer Tools tools

JSON Formatter
Format, beautify and validate JSON data online
Diff Checker
Compare two texts side by side
HTML Minifier
Minify HTML code to reduce page size and improve load times
CSS Minifier
Minify and compress CSS code to shrink file size and speed up your site
SQL Formatter
Format and beautify SQL queries
JWT Decoder
Decode and inspect JWT tokens
Cron Parser
Parse and explain cron expressions
Color Picker
Pick colors and get HEX, RGB, HSL values