← All Tools

Regex Tester

Check what a regular expression does and what it finds, or find one from examples.

Runs in your browser · nothing is sent

Start by typing a pattern in step 1, or open “Load example” in step 2.

Your pattern

Options
More options

Matches are highlighted in the text and numbered. The full list is under Result.

  • Match (underlined, with its number)
  • Dashed outline: found by several patterns (Advanced)

What your pattern does

    • Position
    • Characters
    • How many
    • Group / either-or
    • Escaped character
    • Exact text

    Result

    0 matches

    Advanced: test several patterns at once

    Pattern boxes

      Each box is a pattern tested on the same text and highlighted in its own colour. Select a box to edit it in step 1; drag the handle or use ↑ ↓ to reorder. The share link holds the patterns only, never your text.

      Common patterns
      Regex quick reference

      Characters

      • . any character except a line break (all, with “Dot matches new line”)
      • \d a digit 0-9 · \D not a digit
      • \w a letter, digit or _ · \W anything else
      • \s a space, tab or line break · \S anything else
      • [abc] one of a, b, c · [^abc] any other character
      • \. a real dot (a backslash makes a symbol literal)

      How many

      • * 0 or more · + 1 or more · ? 0 or 1
      • {n} exactly n · {n,} n or more · {n,m} n to m
      • Add ? after any of these to take as few as possible

      Position

      • ^ start · $ end (of each line with “^ $ per line”)
      • \b a word edge · \B not a word edge
      • (?=x) followed by x · (?!x) not followed by x
      • (?<=x) right after x · (?<!x) not right after x

      Groups

      • (abc) group, saved as $1, $2 …
      • (?<name>abc) group saved by name
      • (?:abc) group, not saved
      • a|b either a or b · \1 the same text as group 1 again