Marketing ToolsMartech Zone Tools

Regex Tester: Color a Pattern and Test Every Term

A regular expression has to do two jobs in one line. It has to match the terms you want, and it has to leave the rest alone. The symbols that make that possible are also what make the line hard to read. A caret, a dot, and a plus sign sit next to ordinary letters, and a small change in one of them changes the whole test.

The Regex Tester below colors each piece of a JavaScript (JS) pattern and writes that piece in plain English. Paste one phrase per line. Each line is marked PASS when the pattern matches and FAIL when it does not.

Regex Tester v1.0.6Last Update: Oct 6, 2026

Enter a JavaScript pattern, then paste the phrases you want to test, one per line.

Required — The expression, without surrounding slashes. Pasting /pattern/flags fills the flags for you. Matching uses the browser’s JavaScript engine, so a pattern that passes here can still fail in PHP, nginx, or Google Analytics.
  • abc literal
  • \d class
  • \. escaped
  • [a-z] set
  • () group
  • + quantity
  • ^ anchor
  • | or
Flags
Enter a pattern to test it.
Optional — One phrase per line. A line passes when the pattern matches anywhere in it, unless the pattern uses ^ and $.

Copy pattern

Was this helpful?

What the Colors Mean

The pattern field paints each symbol as you type, using the same colors as the legend under the box:

  • Literal: ordinary characters that must appear as written.
  • Class: a shorthand such as digits or word characters.
  • Escaped: a symbol that should be read as itself, such as a dot in a domain.
  • Set: a bracketed list or range of allowed characters.
  • Group: parentheses that keep a piece together.
  • Quantity: how many times the previous piece may repeat.
  • Anchor: the start or the end of the text.
  • Or: a vertical bar between alternatives.

A character that the pattern cannot finish, such as an open parenthesis, is marked as an error and the test stops.

Test Phrases

Paste as many lines as you want into the one box. Blank lines are skipped. A line that is only spaces is still a phrase.

Each line gets a pill on the right: PASS in green when the pattern matches, and FAIL in red when it does not. A match can sit anywhere in the line unless the pattern uses a start and an end. The bar above the box counts how many lines matched.

What This Pattern Means

Under the box, the tester turns the pattern into a table. The first column is the symbol. The second column is the same piece in plain English. Rows alternate so a long pattern is easier to scan, in both light mode and dark mode. A piece inside a group or a character set is indented under the piece it belongs to.

A quantity stays on the symbol it changes. In abc+, the letters ab are one piece and the plus applies only to c. If the pattern is not valid JavaScript, the table stays hidden and the bar explains the error.

Flags

Flags sit in one closed control. Open it and all eight are listed in two columns. On a narrow screen they stack into one column. Letters you check are added to the control’s title, so you can see them while it is closed.

  • i: Ignore letter case.
  • m: Anchors match each line.
  • s: Dot matches line breaks.
  • g: Find every match.
  • u: Full Unicode character rules.
  • v: Unicode sets, not u. It cannot be combined with u.
  • y: Match from the start.
  • d: Record each match index.

Pasting a pattern that already has slashes, such as /pattern/flags, fills the pattern and checks those flags for you. The test uses the browser’s JavaScript engine. A pattern that passes here can still fail in PHP, nginx, or Google Analytics (GA).

Try This Pattern

Paste this into the pattern field, then paste a few addresses, one per line:

^https://martech\.zone/[\w-]+/?$

The line asks for a secure Martech Zone address, then a path of letters, numbers, underscores, or hyphens, with an optional slash at the end. The table under the box says the same thing, one row at a time.

Related Articles