DevToolsHub

Regex Tester

Test JavaScript regular expressions with live match highlighting, a match list, and multiple test strings (one per line).

Ad unit (leaderboard)

Matches will appear here.

Regex symbols reference

Each symbol with a short description and example of what it matches.

Anchors & boundaries
SymbolDescriptionExample patternMatches (idea)
^Start of string (start of each line with m flag).^Hello"Hello" at start of text
$End of string (end of each line with m flag).end$text ending in "end"
\bWord boundary (between word \w and non-word).\bcat\b"cat" as whole word, not "category"
\BNot a word boundary.\Bcat"cat" inside a word, e.g. "vacation"
Character classes
SymbolDescriptionExample patternMatches (idea)
.Any single character except newline (with s flag, includes newline).a.c"abc", "a1c" — not "a\nc"
\dDigit 0–9.\d{3}"123" — three digits in a row
\DAny non-digit.\D+runs of letters/symbols between numbers
\wWord character: letter, digit, or underscore.\w+"foo", "x_1"
\WNon-word character (spaces, punctuation).\Wspace, comma, @, etc.
\sWhitespace (space, tab, newline, etc.).\s+one or more spaces/tabs
\SNon-whitespace.\S+first "word" without spaces
[ ]Any one character inside brackets.[aeiou]any single vowel
[^ ]Any character NOT in brackets.[^0-9]any char that is not a digit
[a-z]Range inside brackets.[A-Z][a-z]+"Hello" style capital + lowercase
Quantifiers (how many times)
SymbolDescriptionExample patternMatches (idea)
*Zero or more of the previous.ab*c"ac", "abc", "abbbc"
+One or more of the previous.\d+"42", "007" — not ""
?Zero or one (optional).colou?r"color" or "colour"
{n}Exactly n times.\d{4}exactly 4 digits, e.g. year
{n,}At least n times.\w{3,}words with 3+ letters
{n,m}Between n and m times.\d{1,3}1 to 3 digits
*? +? ??Lazy (non-greedy): as few repeats as possible.<.*?>shortest span inside < >
Groups & alternation
SymbolDescriptionExample patternMatches (idea)
( )Capturing group; remembers match for \1, \2….(\w+)\s+\1repeated word: "hi hi"
(?: )Non-capturing group (grouping only).(?:https?:)//"http://" or "https://"
|OR — match left or right side.cat|dog"cat" or "dog"
(?= )Positive lookahead: followed by pattern without consuming.\d(?=px)digit only if "px" follows
(?! )Negative lookahead: not followed by.\d(?!px)digit not before "px"
(?<= )Positive lookbehind (fixed length in some engines).(?<=@)\w+word after @
(?<! )Negative lookbehind.(?<!\$)\d+digits not after $
Escaping & literals
SymbolDescriptionExample patternMatches (idea)
\Escape special characters to match them literally.\.a literal dot, not "any char"
\.Literal period.file\.txt"file.txt"
\* \^ \$ etc.Special chars need \ when you want the character itself.\(\)literal parentheses
Common escapes
SymbolDescriptionExample patternMatches (idea)
\nNewline character.line\nlinetwo lines separated by newline
\tTab.\t+one or more tabs
\\Backslash in pattern (in JS string often "\\").C:\\UsersWindows-style path segment
Flags (checkboxes above)
SymbolDescriptionExample patternMatches (idea)
gGlobal — find all matches, not just the first./\w+/gevery word in the string
iIgnore case — A equals a./hello/i"Hello", "HELLO"
mMultiline — ^ and $ match each line.^#start of every line
sDotAll — . matches newline too..*entire block including line breaks
uUnicode mode — correct handling of surrogate pairs, \u{…}.with u flagfull Unicode code points, not half-pairs
Ad unit (rectangle)

How to use

  1. Enter your pattern (JavaScript regex syntax).
  2. Toggle flags: g for all matches, i for case-insensitive, m for multiline ^/$, s for dotAll, u for Unicode.
  3. Paste text in Test string to see highlighted matches and a match table.
  4. Use Multiple test strings to validate one pattern against many lines.
  5. Share URL copies a link with your pattern and sample text encoded.
  6. Expand Regex symbols reference below the tool for each symbol, description, and example.