SMALL TOOLS. BIG POSSIBILITIES.111 free tools
FREE · NO SIGN-UP · LOCAL PROCESSING

Regex Tester

Test JavaScript regular expressions, captures, flags, and replacements.

Loading tool controls…

Syntax reference: MDN’s JavaScript regular-expression guide. Filtering Search Console? Ten tested Search Console regex patterns.

A PRACTICAL STARTING POINT

Get a useful result from Regex Tester.

Check a regex against real test text before using it in your code. This free online regex tester and regular expression checker uses JavaScript; it highlights matches, shows numbered and named captures, and previews replacements in your browser. Start with a practical example, then include both text that should match and near misses that should not.

When this tool helps

  • Extract four-digit order IDs from a short log without matching longer IDs.
  • Check complete lines with anchors and compare Global and Multiline behavior.
  • Preview a date-text replacement before changing a document; date formatting is not calendar validation.
  • Check a Google Search Console query or page filter for RE2 syntax it will reject before pasting it into the Performance report.

Start with matching text and near misses

A pattern that returns one expected match can still accept unwanted input. Include a valid example, a missing prefix, an extra digit and an empty line. The four example buttons load editable patterns and sample text; they do not run automatically or silently replace a result. Select Test expression after loading or editing.

Choose JavaScript flags deliberately

Global (g) finds repeated matches; without it, this tester reports the first match. Ignore case (i) changes letter matching. Multiline (m) makes ^ and $ apply to line boundaries, while Dot all (s) lets a dot match line breaks. Unicode (u) and Unicode sets (v) are mutually exclusive here. Available syntax depends on your browser; PCRE and Python patterns are not interchangeable with JavaScript.

Inspect captures and replacement output

The highlighted text shows where a match occurs. The details table reports zero-based UTF-16 offsets and numbered or named captures; empty matches are marked separately. Enable Preview replacement to use $1 for a numbered capture, $<name> for a named capture or $& for the whole match. Inspect the full replacement before copying or downloading it. A successful test is not a guarantee that the pattern suits every input.

Build a simple regex from literal phrases

Open Build a pattern from words or phrases to combine up to 20 phrases without writing alternation syntax yourself. The builder escapes punctuation, so C++ and example.com are treated as literal text rather than regex operators. Choose a match anywhere or a complete line, then test with examples and near misses. It enables Global, Ignore case and Multiline for the local JavaScript preview. This is a bounded literal-pattern builder, not AI generation, a full validation wizard or an RE2 runtime. For Search Console, copy only the pattern, without JavaScript flags, and review the compatibility notes.

Test a regex for Google Search Console filters

Search Console’s Custom (regex) filter uses RE2 syntax, not JavaScript. RE2 rejects lookahead, lookbehind, backreferences, atomic groups and possessive quantifiers, so a pattern that works here can fail there. The Search Console check under the pattern field flags those constructs as you type and suggests a replacement. Matching in Search Console is case-insensitive by default, counts a match anywhere in the query or URL unless you add ^ or $, and tests each value separately. To preview that behavior, paste one query per line and turn on Multiline and Ignore case, or load Filter question queries. Use (?-i) in Search Console when case must match; it has no checkbox there. The check is a syntax scan based on Google’s documentation, not a live Search Console request, and filtered report totals can still omit anonymized queries.

Test Python, Java or PHP regex in JavaScript

Most everyday syntax works the same in JavaScript, Python, Java and PHP: character classes, quantifiers, anchors, groups and \b word boundaries. Check these differences before you copy a pattern between languages. Python names a group with (?P<name>…) and reuses it with \g<name> in a replacement; JavaScript uses (?<name>…) and $<name>. Java and PHP replacements use $1, while Python uses \1. In Java and most other source code, every backslash in a string literal is doubled, so \d becomes "\\d". PHP’s preg functions need delimiters such as /pattern/i; enter the pattern here without them. Python lookbehind must have a fixed width, while JavaScript also accepts variable-length lookbehind. JavaScript has no possessive quantifiers or atomic groups, which PCRE and Java support. When behavior matters, rerun the final pattern in your target language.

Handle errors and expensive patterns safely

Invalid syntax produces an error rather than a match result. Work runs in a separate local worker with a two-second processing deadline and cancellation, keeping a pathological expression from running indefinitely in the page. Inputs are bounded to 100,000 text characters and 4,000 pattern characters, with up to 1,000 reported matches and a 1 MB report/replacement limit. A truncated match list is not an exhaustive report; replacements require a complete list.

Example input

Pattern: \bORD-(?<number>\d{4})\b
Flags: g
Text: Packed ORD-1042. Pending ORD-2098. Ignore ORD-12345.

Expected output

Match 1: ORD-1042; number = 1042
Match 2: ORD-2098; number = 2098
ORD-12345 does not match.

Load Extract order IDs in the tool to run the example. The trailing word boundary prevents accepting the first four digits of a longer ID. Your own identifier rules may differ.

Common regex patterns, tested

Each pattern below was checked in JavaScript against the examples shown. Paste one into the pattern field, add your own text and include near misses. These are practical checks, not complete standards: a pattern that accepts an email address does not prove the mailbox exists.

TaskPatternMatchesDoes not match
Email address (practical check)^[^\s@]+@[^\s@]+\.[^\s@]+$jane@example.comjane@example
Web address (http or https)^https?:\/\/[^\s/?#]+\.[^\s/?#]+(?:[/?#]\S*)?$https://zemopro.com/toolsftp://example.com
US ZIP code^\d{5}(?:-\d{4})?$94103, 94103-12349410
US phone number^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$(415) 555-0132555-0132
Date as YYYY-MM-DD^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$2026-11-242026-13-01
IPv4 address^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$192.168.0.1256.1.1.1
Hex color^#(?:[0-9a-fA-F]{3}){1,2}$#0af, #00AAFF00aaff
URL slug^[a-z0-9]+(?:-[a-z0-9]+)*$regex-testerdouble--dash
Password: 8+ characters with lowercase, uppercase and a digit^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$Tester2026tester2026
Leading or trailing spaces (use the g flag)^\s+|\s+$“ padded ”“no-padding”

Questions about this task

How can I test a regex online?

Enter the pattern without surrounding / delimiters, choose flags and paste test text. Select Test expression to inspect highlights and captures. You can load a sample first, then change it and rerun.

Does this regex tester use Python or PCRE?

No. It uses your browser’s JavaScript regular-expression engine. Test syntax and behavior again in your actual target language or runtime before deploying it.

Why does my regex find only one match?

Check the Global (g) flag. Without Global, this tester reports only the first match. Also review anchors, case sensitivity and the test input.

Can I test a Google Search Console regex here?

Yes, with one difference to keep in mind. Search Console uses RE2, which does not support lookahead, lookbehind or backreferences, and it matches case-insensitively by default. Type your filter and read the Search Console check for unsupported syntax, then test it against one query per line with Multiline and Ignore case on.

What regex should I use to validate an email address?

A practical check is ^[^\s@]+@[^\s@]+\.[^\s@]+$: some text, one @, and a domain containing a dot, with no spaces. It rejects obvious typos but does not implement the full email standard or prove that the address receives mail. Send a confirmation message when delivery matters.

Can I preview regex find and replace?

Yes. Enable Preview replacement and enter replacement text. Numbered captures such as $1 and named captures such as $<year> can be reused in the output. Review the full result before downloading.

Is my test text uploaded?

Regex computation and the match report stay in your browser; no regex API is called. The site’s separately disclosed Google measurement integration can make requests, so avoid putting private data in page URLs. Use illustrative or redacted test inputs when possible.

How to use Regex Tester

Enter a pattern without surrounding slashes, select flags, and add test text. Run the test to inspect highlighted matches and captures. Optionally preview a replacement using JavaScript replacement syntax.

Good to know

Uses your browser’s JavaScript regex engine. Text is limited to 100,000 characters, patterns to 4,000 characters, matches to 1,000, and match data to 1 MB. A separate worker is terminated after two seconds of processing. Offsets use UTF-16 code units; behavior can differ from PCRE or Python.

A few helpful answers

Is this tool free?

Yes. All features on this page are free and require no account.

Where is my data processed?

In your browser. Tool input and selected images are not sent to our servers. Clear the page or close the tab to discard your input.

What should I check before using the result?

Uses your browser’s JavaScript regex engine. Text is limited to 100,000 characters, patterns to 4,000 characters, matches to 1,000, and match data to 1 MB. A separate worker is terminated after two seconds of processing. Offsets use UTF-16 code units; behavior can differ from PCRE or Python.

WhatsApp