— Developer Tools

Free Regular Expression Tester

See every match, capture group, and replacement update as you type.

— Samples

Type the pattern only. Leave off the slashes some languages put around it.

Flags

2 matches0 groupsValid
Live

What is a Regular Expression Tester?

A regular expression tester highlights every match in your sample while you edit the pattern. Backend engineers, quality assurance analysts, and support leads use it to confirm a check before that check lands in validation code.

Matches, groups, and replacements update in the browser on each keystroke. The sample stays on this machine, and you do not need an account.

Key Features

Catch a broken pattern before it ships

Every match lights up in the sample while you type, so a missing escape shows up before the pattern reaches validation code. You see the span itself, not a single yes or no.

Read the groups, not a boolean

Numbered groups and named groups list the text they caught, with the start and end offsets in the sample. You can check year, month, and day without guessing which pair of parentheses held them.

Preview a rewrite before any script

Replacement tokens fill in from the groups, and the rewritten sample updates on the same keystroke. You can confirm the new shape before a migration script touches a single row.

Start from a sample, then bend it

Email, date, color, web address, and log lines each load a pattern you can edit until it fits your text. A blank box is still there when none of those samples is close.

Keep the sample on this machine

The match runs locally in the browser, so a log line or a customer address never leaves the tab. You do not create an account to run it.

Perfect for everyone

  • Backend engineers
  • Quality assurance analysts
  • Support leads who parse logs
  • Students learning pattern syntax

How to Use the Regular Expression Tester

You can test a pattern in four moves. The preview follows the text, so the highlight is what you trust before you copy anything into a file.

1

Type the pattern

Type the pattern body and leave the surrounding slashes off. Those slashes are how some languages write a pattern in source code, and here they would be searched for as ordinary characters. The highlight updates on the next keystroke, so you can fix an escape before you paste the pattern into a file.

2

Paste a test string

Paste the text you actually need to check, such as a form value, a log line, or a paragraph from a ticket. Matches mark themselves in that text, and each one lists the groups it captured. A sample chip at the top loads a starter string if you want to explore before you bring your own.

3

Choose the flags

Turn on g to find every match, i to ignore letter case, and m when a caret or dollar sign should apply to each line. Use s when a dot must cross a line break, and u when you need Unicode character classes. Leave a flag off and the preview shows what your language will do with that same setting.

4

Copy the result

Copy the match list when you need the captured text, or switch to Replace and copy the rewritten string. The download button saves that same text as a plain file. Drop the pattern into your validator, your log query, or your review comment once the highlight matches what you expected.

— the catalog

Tokens you will actually test

These ten tokens cover most patterns people bring to a regular expression tester. Each row is the idea, a tiny pattern, and the text that pattern is meant to catch.

01 / ANCHORS

Anchors

A caret and a dollar sign pin a match to an edge instead of letting it float inside the text. Use them when a value must fill the whole field, not merely appear somewhere in it.

“^\d{4}$”

02 / CHARACTER

Character classes

A class lists the characters allowed in one position, and a leading caret inside the brackets flips that list. A range such as A to Z stays shorter than writing each letter out.

“[A-Z]{3}”

03 / QUANTIFIERS

Quantifiers

A quantifier says how many times the previous token may repeat, from one optional mark to an open-ended star. Bound it with a minimum and a maximum when an open star would run too far.

“\d{2,4}”

04 / ALTERNATION

Alternation

A pipe chooses between branches, and the engine takes the first branch that works. Group the branches when the choice should not swallow the tokens sitting on either side.

“INFO|WARN|ERROR”

05 / CAPTURING

Capturing groups

Parentheses remember the text they match so you can read it back as a numbered group. They also limit how far a quantifier or a pipe is allowed to apply.

“(\d{4})-(\d{2})”

06 / NAMED

Named groups

A name on a group shows up in the match list and in a replacement, which is easier to read than a bare number. The name does not change what the group matches.

“(?<year>\d{4})”

07 / LOOKAHEAD

Lookahead

A lookahead checks what comes next without including those characters in the match. Use it when a rule must see a digit that you do not want to consume.

“\d(?=px)”

08 / LOOKBEHIND

Lookbehind

A lookbehind checks what came before the match and, like lookahead, does not consume those characters. It helps when a currency symbol must be present but should stay out of the amount.

“(?<=\$)\d+”

09 / FLAGS

Flags

Flags change the whole pattern: g finds every match, i ignores case, m moves the line anchors, and s lets a dot cross a newline. Set them with the toggles rather than typing them into the pattern body.

“error”

10 / ESCAPES

Escapes

A backslash turns an operator into a literal character, or turns a letter into an operator such as a digit class. When a match looks too wide, the missing backslash is the first place to look.

“example\.com”

Worked Examples

Patterns Run on Real Text

Each row is a pattern with its flags, a line of three dashes, then the test string. The hidden answer is the match list this tester produced, offsets and groups included, so predict it before you reveal it.

REF_001Email addresses

“/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g --- Reach ada@example.com or grace.hopper@navy.mil before Friday.”

REF_002Named groups

“/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/g --- Shipped 2026-09-22. The previous build was 2026-03-01.”

REF_003Greedy URL grabs the period

“/https?:\/\/[^\s]+/g --- Docs live at https://naviohq.com/developer.”

REF_004Hex colours

“/#(?:[0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})\b/gi --- Ink #141210, paper #F8F4EC, accent #C45.”

REF_005Multiline log lines

“/^(\d{2}:\d{2}:\d{2})\s+(INFO|WARN|ERROR)\s+(.*)$/gm --- 09:14:02 INFO server listening on 3000 09:14:11 WARN retry scheduled 09:15:40 ERROR connection reset”

REF_006Anchored whole value

“/^\d{4}$/ --- 2026”

REF_007Lookbehind

“/(?<=\$)\d+/g --- The refund was $48 and the note said 48.”

REF_008Optional letter, ignore case

“/colou?r/gi --- Color, colour and COLOR.”

REF_009No global flag

“/\d+/ --- Order 12 of 40”

REF_010Numbered groups

“/(\w+)@(\w+)\.com/g --- ada@example.com, bob@test.com”

Checks worth running before the pattern ships

People open a regular expression tester when a pattern is about to touch real data. These are the checks that usually show up in that hour.

Stop a bad email check in review

Run the address pattern against real values from the signup form before the release branch is cut. You will see which addresses match and which ones the pattern quietly drops.

Pull dates out of a release note

Point the date pattern at a changelog and confirm year, month, and day land in separate groups. That check takes a few seconds and saves a broken parse in the import script.

Split a production log line

Match the timestamp, the level, and the message as three groups on a real log excerpt. You can see whether a warning and an error both match before the alert rule goes live.

Check color tokens in a stylesheet

Highlight every hex color in a token file so a three-digit form is not missed next to a six-digit one. Designers and front-end engineers can agree on the pattern before it is copied into the linter.

Rewrite a column before a migration

Switch to Replace and preview how numbered and named groups rewrite a column of values. You can confirm the new shape on a sample before a script touches the table.

Walk a teammate through one token

Load a sample during a review and edit one token at a time so the other person sees the highlight move. That is faster than describing a quantifier in a comment thread.

— build it

Build a pattern from one real value

You can write a pattern by hand from a single example instead of starting with a star. The plate on the side is the order that keeps the first draft small enough to trust.

P01

Start with the literal text

Write the characters you must see, and escape any dot, plus, star, or parenthesis that should stay literal. A pattern that begins as plain text is easier to widen than one that starts with a star.

naviohq\.com

P02

Add a class where the text varies

Replace one varying character with a class or a shorthand such as a digit class. Keep the class as small as the real data allows so you do not accept characters the field will never contain.

id-\d{4}

P03

Set a count instead of an open star

Put a minimum and a maximum on the token that repeats, because an open star will cross a delimiter you meant to stop at. A count also documents the rule for the next person who reads the pattern.

\d{4}-\d{2}-\d{2}

P04

Capture only the piece you will reuse

Wrap the part you need to keep, and leave the surrounding labels outside the parentheses. A named group pays off as soon as a replacement or a log parser has to mention that piece again.

WARN\s+(?<message>.*)

P05

Anchor when the whole value must match

Pin the start and the end when a field should contain nothing except the pattern. Without those anchors, a long string can hide a valid fragment in the middle and still look like a pass.

^[^@]+@[^@]+\.[^@]+$

P06

Test the failure on purpose

Add one string you expect to reject, not only the strings you expect to accept. A pattern that matches everything in a happy sample often fails the first messy ticket that reaches production.

not-an-email

— five moves

Five moves from a value to a pattern

  1. 1

    Write the value you must match

    Put one real value in the test string before you write any tokens. A concrete value keeps you from inventing a pattern for text you do not actually have in the ticket.

  2. 2

    Mark the parts that stay fixed

    Type the words and symbols that never change, and escape the operators among them. Fixed text is the skeleton, and the classes you add later hang on that skeleton instead of replacing it.

  3. 3

    Replace each varying spot

    Swap one varying spot at a time for a class or a limited count, then watch the highlight. If the highlight jumps past the end of the value, the count is too open.

  4. 4

    Capture what a later step needs

    Add parentheses only around the text a later step will use, and give that group a name if you will mention it again. Extra groups make the match list noisy and make a replacement harder to read.

  5. 5

    Reject one near miss

    Paste a near miss that should fail, such as a missing domain ending or a level your alert should ignore. If that near miss still highlights, tighten an anchor or a class before you trust the pattern.

Once the good value highlights and the near miss does not, copy the pattern into the code that will run it.

When the highlight is wrong

A flag or a quantifier changes the highlight more than a longer pattern does. Reach for these when a match looks plausible and still is not the text you wanted.

Tip 01

Turn global matching on for a full scan

Without g, the tester stops after the first hit, which hides later failures in a long sample. Turn g on when you need every address, date, or error line in the text.

Tip 02

Use multiline when each line is a record

A caret matches only the start of the whole sample until you turn m on. With m, each log line can start a new match, which is what you want for line-oriented files.

Tip 03

Prefer a lazy quantifier when the match runs long

A greedy star consumes as much as it can and then gives characters back, so it often swallows the next delimiter. A question mark after the star stops at the first delimiter instead.

Tip 04

Name a group when the number gets hard to read

A named group such as year stays readable in the match list and in a replacement. Use a name once a pattern has more than two captures and the number alone no longer tells you which text is which.

Tip 05

Shorten the sample when nested quantifiers are refused

A group that is quantified and also contains a star or plus can lock the tab on a long string. The tester stops that case past 16 characters, so try the pattern on a short sample first.

Tip 06

Escape a literal dot, plus, or star

Those characters are operators, so a domain written with a bare dot will match any character in that position. Put a backslash before the character when you mean the character itself.

More developer tools

Frequently Asked Questions