Regex Tester
Test regular expressions with live highlighting, capture groups, replace, split and a plain-English explanation. Python, PHP, Java, C# and Go syntax is converted for testing. Runs in your browser.
- Free, no sign-up
- Live highlighting
- Groups and positions
- Replace and split
- Code for 6 languages
- Nothing uploaded
People also use
How to test a regular expression in three steps
Type a pattern in the box above, paste some text under it, and every match lights up as you type. This regex tester lists each match with its numbered and named groups and their positions, replaces and splits text, checks a list line by line, and explains the pattern in plain English, piece by piece.
It also turns common Python, PCRE, Java, .NET and Go syntax into JavaScript before testing, offers ready-made patterns to start from, and writes the code for six languages. Everything runs in your browser and nothing is uploaded.
- 1
Type the pattern
Enter the regular expression between the slashes, without the slashes themselves. Turn on the flags you need, and pick the flavour (JavaScript, Python, PCRE (PHP), Java, .NET (C#) or Go) if the pattern was written for another language.
- 2
Paste your test string
Put the text you want to search in the Test string box. Matches are highlighted in two alternating colours, and the number of matches and the time in milliseconds appear on the right.
- 3
Pick a mode and copy
Choose Match, Replace, Split or Test each line. Read the groups in the table, download them as CSV, copy the replaced text, or open Use it in code for a ready snippet.
The page runs again a moment after you stop typing. A red border and an Error in the pattern message mean the expression cannot be compiled, and the message says why, for example an unterminated group.
Regex tester online: how the page works
A regex tester online should work the moment the page loads, and this one does: the first pattern in the library, an email address finder, is already filled in with sample text, so you see what a result looks like before you type anything. There is no account, no install and no button to press. Results update about a tenth of a second after you stop typing.
Matching happens in a background worker, a separate thread of your browser. That keeps the page responsive with long texts, and it lets the page stop a pattern that runs longer than 1.5 seconds. A pattern that would freeze a normal page simply returns a message here, and you can fix it and carry on.
The Test string box takes whatever you paste: log lines, CSV rows, HTML, source code or ordinary prose. Long inputs are fine, though the table lists the first 500 matches and the counter stops at 5,000, shown as 5000+.
Regex tester with capture groups: the match table
Parentheses in a pattern capture the text they match, and seeing those captures is often the whole point of testing. In Match mode the table on the right lists every match in four columns: its number, the matched text, its position as start–end character offsets, and its groups.
Numbered groups appear as $1, $2 and so on. Named groups, written (?<year>\d{4}) in JavaScript, show their name instead, such as year: 2026. A group that took no part in the match shows a dash, which is different from a group that matched an empty string. Turn on the d flag to also see where each group starts, written as @ followed by the offset.
When you want a regex tester with capture groups you can take elsewhere, press CSV above the table. The file regex-matches.csv has one row per match with the number, start, end, match and one column per group, and it opens cleanly in Excel or Google Sheets. Non-capturing groups (?:…) group without capturing, so they add no column.
Positions count JavaScript characters, which are UTF-16 code units, so an emoji or a rare symbol counts as two. That is the same count your JavaScript code sees through match.index.
Regex tester with replace: $1, $<name> and $&
Switch the mode to Replace and a replacement box appears. It starts with [$&], which wraps every match in square brackets, so you can see at once what will change. The result appears on the right with a Copy button.
The replacement uses JavaScript syntax: $1 to $99 insert numbered groups, $<name> inserts a named group, $& inserts the whole match, $` the text before it, $' the text after it, and $$ a literal dollar sign. For example, the pattern (\d{4})-(\d{2})-(\d{2}) with the replacement $3/$2/$1 turns 2026-10-21 into 21/10/2026.
Without the g flag only the first match is replaced, and the page reminds you of this under the result. A regex tester with replace preview is the safest way to try a bulk edit before you run it in an editor or a script, because you see the full output first. Other languages write group references differently; the flavour table further down lists them.
Split and Test each line
Split cuts the test string wherever the pattern matches and lists the parts, numbered and in quotes, so empty parts and stray spaces are easy to spot. A pattern such as \s*,\s* splits a comma list and trims the spaces around each item. If the pattern has capture groups, the captured separators appear in the list as well, which is how JavaScript's split works. Up to 1,000 parts are shown.
Test each line checks every line of the test string on its own and marks it with a tick or a cross, with a total such as 7 of 9 lines match. This is the mode for validation patterns that use ^ and $, like a postcode or a username rule: paste good and bad examples, one per line, and see at a glance which ones pass. The g flag is ignored here, because each line gets a single yes or no.
Flags g, i, m, s, u, y and d explained
Click a flag to turn it on or off. The flags in use are shown after the closing slash, like /…/gi. Inline flags at the start of a pattern from another flavour, such as (?i), are moved into this list automatically.
| Flag | Button label | What it does |
|---|---|---|
| g | global | Find every match instead of stopping at the first. Replace needs it to change every match. |
| i | ignore case | A matches a, and a matches A. |
| m | multiline | ^ and $ match at the start and end of each line, not only of the whole text. |
| s | dot matches line breaks | Lets the dot match \n and \r too. |
| u | Unicode | Treats an emoji as one character and enables \p{…} classes. |
| y | sticky | Each match must start exactly where the previous one ended. |
| d | group positions | Records where each group starts, shown with @ in the table. |
Regex tester and debugger: explanation, details and timing
When a pattern does not behave, three things help: knowing what each part means, seeing exactly what matched, and knowing whether it is slow. The card What this pattern means splits the pattern into pieces and explains each one in plain English, indented to show nesting. A character class becomes a list of what it allows, a quantifier is described as one or more times or between 2 and 5 times, and a lookahead is labelled as not part of the match.
The match table then shows each hit with its position and groups, and the counter shows how many milliseconds the run took. A time that jumps from 1 ms to hundreds of milliseconds as you add text is an early warning of backtracking trouble.
To be clear about what it is: this regex tester and debugger combination explains and measures, but it does not step through the engine's backtracking one move at a time. For most bugs, such as a missing escape, a greedy .* that eats too much, or a forgotten m flag, the explanation and the table point to the cause quickly.
Regex tester JavaScript: the engine behind every result
Every test on this page runs on your browser's own JavaScript engine through new RegExp. That makes it a true regex tester javascript developers can rely on: what matches here matches in the same browser in your code, including named groups, lookbehind of any length, the s and d flags, and \p{…} Unicode classes with the u flag.
Current browsers have supported these features for years. Node.js uses the same V8 engine as Chrome, so results there match Chrome's. The v flag is not offered on this page.
Mind the backslashes when you move a pattern into code. In a literal such as /\d+/ they stay single, but inside a string each one is doubled: new RegExp("\\d+"). The JavaScript tab under Use it in code writes the literal form with any / escaped, plus a matchAll loop and a replace line.
Regex tester Python: (?P<name>), \A and \Z converted
Pick Python from the flavour menu and paste the pattern as you would write it inside r"…". The converter rewrites Python-only syntax into JavaScript before testing, and a blue box lists each change, with the final pattern under Tested as.
- (?P<name>…) becomes (?<name>…), and (?P=name) becomes \k<name>
- \A becomes ^, and \Z or \z becomes $ (leave the m flag off)
- A leading (?i), (?m) or (?s) becomes the matching flag
- A leading (?x) is noted: spaces are kept, so remove spaces and comments yourself
That makes the page a practical regex tester python developers can use for re patterns, with limits worth knowing. Python's lookbehind must have a fixed width, while JavaScript accepts any width, so (?<=\w+) passes here and raises an error in Python. The re module has no \p{L} classes (the separate regex package does). In Python 3, \w and \d match letters and digits from every script by default, while JavaScript's \w is ASCII only, so a word like café can match differently.
The Python tab writes re.compile with re.IGNORECASE, re.MULTILINE and re.DOTALL as needed, turns named groups back into (?P<name>…), and shows findall and sub with \1 as the replacement.
Regex tester for Java: Pattern and Matcher
Java's java.util.regex is close to JavaScript for everyday patterns. Choose Java as the flavour and the converter handles the extras it knows: atomic groups (?>…) and possessive quantifiers such as a++ are approximated as normal groups and greedy quantifiers, \Q…\E literal text is escaped, \h becomes [ \t], and \A and \z become anchors. A note marks each approximation, because atomic and possessive forms stop backtracking and the plain versions do not, so a few patterns can match differently.
In Java source every backslash is doubled, so \d is written "\\d". The Java tab writes Pattern.compile with the pattern already escaped as a Java string and adds Pattern.CASE_INSENSITIVE when the i flag is on; add Pattern.MULTILINE or Pattern.DOTALL yourself for m and s. Java needs lookbehind with a bounded length, so a lookbehind with + or * that works here can fail to compile there.
As a regex tester for java code it gets you to the right pattern quickly. Run the final version once in your own project to confirm.
Regex tester for C#: .NET syntax
Choose .NET (C#) as the flavour for patterns from C#, VB.NET or PowerShell. .NET writes named groups as (?<name>…), the same as JavaScript, so most patterns need no change at all. Atomic groups, \A, \z and leading inline flags are converted with notes, as for Java.
.NET has two features with no JavaScript equivalent: balancing groups such as (?<open-close>…), used to match nested brackets, and conditionals (?(…)…). The note says so instead of guessing, and those patterns cannot be tested here. Like JavaScript, .NET allows lookbehind of any length, but its \d matches digits from every script unless you use RegexOptions.ECMAScript.
The C# tab writes a verbatim @"…" string, so backslashes stay single, with RegexOptions.IgnoreCase for the i flag; add RegexOptions.Multiline or RegexOptions.Singleline for m and s. Used as a regex tester for c# work, it is quickest for checking groups and replacements before you write the code.
PHP (PCRE) and Go patterns
PCRE (PHP) covers preg_match and preg_replace patterns. Paste the part between the delimiters, without the slashes and modifiers, and set flags with the buttons. Converted PCRE extras: \h becomes [ \t], POSIX classes such as [[:alpha:]] and [[:digit:]] are expanded, \Q…\E is escaped, atomic groups and possessive quantifiers are approximated, and a leading (?i) or (?s) becomes a flag. Recursion such as (?R) and conditionals cannot be converted, and the note says so. The PHP tab writes preg_match_all and preg_replace with the u modifier added, so UTF-8 text is handled properly.
Go uses the RE2 engine, which never backtracks and so never hangs, but it leaves out lookahead, lookbehind and backreferences such as \1. This page will happily test those, so a pattern can work here and then fail in regexp.MustCompile. Keep Go patterns to groups, classes, alternation and quantifiers. Go supports (?P<name>…) named groups, which the converter rewrites for testing, and the Go tab adds (?i) when you use the i flag.
Flavour differences at a glance
For the everyday core of classes, quantifiers, anchors, groups and alternation, all six flavours agree, which is why results for other languages are usually the same as here. They are not guaranteed to be the same, so test the final pattern once in its real language. These are the differences that come up most:
| Feature | JavaScript | Python re | PCRE (PHP) | Java | .NET | Go |
|---|---|---|---|---|---|---|
| Named group | (?<n>…) | (?P<n>…) | (?<n>…) or (?P<n>…) | (?<n>…) | (?<n>…) or (?'n'…) | (?P<n>…) |
| Named backreference | \k<n> | (?P=n) | \k<n> or (?P=n) | \k<n> | \k<n> | none |
| Lookbehind | any length | fixed width | fixed width (limited variable in new PCRE2) | bounded length | any length | none |
| Unicode class \p{L} | with u flag | not in re | yes | yes | yes | yes |
| Group in replacement | $1, $<n> | \1, \g<n> | $1 or \1 | $1, ${n} | $1, ${n} | ${1}, ${n} |
| Atomic and possessive | none | since Python 3.11 | yes | yes | atomic only | none |
Regex cheat sheet: tokens, quantifiers, anchors, groups and lookarounds
Characters, classes and quantifiers
| Token | Meaning | Example |
|---|---|---|
| . | Any character except a line break | a.c matches abc and a-c |
| \d \D | A digit 0–9 / anything else | \d\d matches 42 |
| \w \W | Letter, digit or _ / anything else | \w+ matches user_1 |
| \s \S | Whitespace / anything else | a\sb matches a b |
| [abc] | One of a, b or c | gr[ae]y matches grey and gray |
| [^abc] | Any one character except a, b or c | [^0-9] matches a non-digit |
| [a-z] | One character in the range | [A-F0-9] matches a hex digit |
| \. \* \? | The character itself (escaped) | \.com matches .com |
| * | Zero or more | ab* matches a, ab, abbb |
| + | One or more | \d+ matches 7 and 2026 |
| ? | Optional, zero or one | colou?r matches color and colour |
| {3} {2,} {2,5} | Exactly 3 / 2 or more / 2 to 5 | \d{4} matches a year |
| *? +? | Lazy: as few as possible | <.+?> stops at the first > |
Anchors, groups and lookarounds
| Token | Meaning | Example |
|---|---|---|
| ^ | Start of the text (of a line with m) | ^Hello |
| $ | End of the text (of a line with m) | end$ |
| \b | Word boundary | \bcat\b skips concatenate |
| \B | Not a word boundary | \Bcat finds the cat in concatenate |
| (…) | Capture group, numbered from 1 | (\d+)-(\d+) |
| (?:…) | Group without capturing | (?:ab)+ |
| (?<name>…) | Named capture group | (?<year>\d{4}) |
| \1 \k<name> | The same text a group matched | (\w)\1 matches ll in hello |
| a|b | Either a or b | cat|dog |
| (?=…) | Followed by (lookahead) | \d+(?=px) finds 12 in 12px |
| (?!…) | Not followed by | \d+(?!px) |
| (?<=…) | Preceded by (lookbehind) | (?<=\$)\d+ finds 5 in $5 |
| (?<!…) | Not preceded by | (?<!-)\d+ |
Common patterns, ready to load
The Common patterns card loads a pattern together with sample text in one click, switches the flavour to JavaScript and turns on the g flag. They are practical starting points, not full validators, and each is easy to adjust:
Email address
Finds addresses like [email protected]. It cannot prove an address exists; only sending a message can.
URL
Finds http and https links up to the next space, including paths and query strings.
IPv4 address
Four numbers from 0 to 255 separated by dots, so 999.1.1.1 is rejected.
Date (YYYY-MM-DD)
Captures year, month and day as three groups. Months must be 01–12 and days 01–31, but it does not know that February has no 30th.
US phone number
Ten digits with optional brackets, dashes, dots or spaces, such as (415) 555-0132.
Hex colour
Three or six digit colours like #111 and #2563EB; a five digit value is skipped.
UUID
Versions 1 to 8 in lowercase. Turn on i to accept capital letters too.
Strong password
At least 12 characters with a lowercase letter, a capital, a digit and a symbol, checked by four lookaheads.
US ZIP code
Five digits with an optional four digit extension, such as 10001-1234.
HTML tag
Opening and closing tags, with the tag name in group 1. Fine for a quick scan, not for parsing HTML.
Extra spaces
Two or more spaces in a row. In Replace mode, replace with a single space to tidy text.
Words
Each run of letters, digits and underscores, handy for counting or splitting simple English text.
Worked example: find dates in a log and rewrite them
Here is a full run from start to finish, using a few lines of a server log. The goal is to find every date, see its parts, and rewrite it in day/month/year order.
- 1
Paste the text
Put three log lines in the Test string box, for example: 2026-10-21 GET /home 200, 2026-10-22 POST /login 401 and 2026-11-03 GET /about 200, one per line.
- 2
Write the pattern
Type (\d{4})-(\d{2})-(\d{2}) and keep the g flag on. Three dates light up, and the counter reads 3 matches with the time next to it.
- 3
Read the groups
In the table, match 1 shows $1: 2026, $2: 10 and $3: 21, with its position 0–10. The explanation card lists capture group 1, a digit exactly 4 times, the text -, and so on.
- 4
Name the parts
Change the pattern to (?<y>\d{4})-(?<m>\d{2})-(?<d>\d{2}). The table now labels each value y, m and d, which is easier to read and safer when you add more groups later.
- 5
Rewrite the dates
Switch to Replace and type $<d>/$<m>/$<y>. The result box shows 21/10/2026 GET /home 200 and the other lines rewritten the same way. Press Copy to take the text.
- 6
Check the edge cases
Switch to Test each line, add a line with 2026-1-5 and see it get a cross, because the pattern needs two digits for month and day. Decide whether that is what you want before you use it.
Use it in code: six languages
Under the tool, Use it in code has six tabs: JavaScript, Python, PHP, Java, C# and Go. Each one writes your current pattern, in its converted JavaScript form, the way that language expects it, with the escaping done for you: a literal in JavaScript, a raw string in Python, a quoted pattern with the u modifier in PHP, an escaped string in Java, a verbatim string in C# and a backquoted string in Go.
The snippets carry over the flags each language has a simple equivalent for, and show a typical use: finding all matches, printing each one or replacing with group 1. Treat them as a starting point, check the flags, and run them once with real data. A tool such as the JSON Formatter or the Diff Checker helps when you compare the output before and after a change.
Backslashes and escaping in each language
The pattern itself is the same in every language, but the way you put it into source code is not. The biggest source of confusion is the backslash, which many languages also use inside ordinary strings. This is how the pattern \d+\.\d+ (a decimal number) is written in each language:
| Language | How to write it | Why |
|---|---|---|
| JavaScript | /\d+\.\d+/ or new RegExp("\\d+\\.\\d+") | A literal keeps single backslashes; a string doubles them. Escape / inside a literal. |
| Python | r"\d+\.\d+" | The r prefix makes a raw string, so backslashes stay single. Without it, write \\d. |
| PHP | '/\d+\.\d+/u' | Single quotes keep backslashes; the pattern needs delimiters such as / and modifiers after them. |
| Java | "\\d+\\.\\d+" | Every backslash is doubled inside a Java string. |
| C# | @"\d+\.\d+" | A verbatim string keeps backslashes single; write a quote inside it as two quotes. |
| Go | `\d+\.\d+` | A backquoted raw string keeps backslashes single. |
If a pattern works on this page but finds nothing in your program, print the pattern string at run time. A missing or extra backslash shows up immediately, for example \d turning into a plain d, or \b turning into a backspace character in a normal string.
Regex tester tool tips: faster, safer patterns
A regex tester tool is most useful when you give it the text that should fail as well as the text that should pass. A few habits make patterns quicker to write and safer to run:
- Anchor validation patterns with ^ and $, or a partial match will pass
- Use a specific class like [^"]* instead of .* when you know what may appear
- Make a quantifier lazy (*? or +?) when it should stop at the first closing character
- Escape literal dots, brackets and question marks: \. \( \?
- Use (?:…) for grouping you do not need to capture, to keep group numbers tidy
- Avoid nested quantifiers such as (a+)+ or (.*)* on text that may not match
- Paste a list of near misses into Test each line and check that every one gets a cross
Catastrophic backtracking happens when a pattern can split the same text in a huge number of ways and the engine tries them all before giving up. The classic case is (a+)+$ against a long run of a's that ends with a different letter: each extra character doubles the work. Here the worker is stopped after 1.5 seconds with a message naming the cause. Fix it by removing the nesting, for example a+$, or by making the alternatives unable to match the same text.
What people use regular expressions for
Reading logs
Pull timestamps, error codes or IP addresses out of server logs, and use the CSV export to sort and count them in a spreadsheet.
Cleaning data
Strip extra spaces, normalise dates or phone numbers with Replace, then move on to CSV to JSON or the Case Converter for the next step.
Form validation
Build a rule for usernames, postcodes or product codes and check a list of examples with Test each line before it reaches your form.
Search and replace in code
Try a rename across many lines with groups and $1 before running it in your editor, so nothing unexpected changes.
Extracting from scans
Turn a scanned document into text with Image to Text, then pick out invoice numbers, dates or totals with a pattern.
Routing and redirect rules
Check which paths a redirect or rewrite rule would catch, and use URL Encode when a path contains special characters.
Troubleshooting: when a pattern does not behave
No match, but there should be
Check the flags first: i for case, m for ^ and $ on each line. Then look for an unescaped character such as . or ? and for invisible spaces or tabs in the text.
It matches too much
A greedy .* or .+ runs to the last possible place. Make it lazy with .*? or replace it with a class that cannot cross the end, such as [^<]*.
^ and $ only match once
Without the m flag they mean the start and end of the whole text. Turn on m to work line by line, or use Test each line.
The dot does not cross lines
By default . stops at a line break. Turn on the s flag, or use [\s\S] for any character.
Stopped after 1.5 s
The pattern backtracks too much on this text. Look for nested quantifiers such as (a+)+ or (.*)* and remove the nesting.
Error in the pattern
The browser could not compile it, and the message says why, such as an unterminated group or a nothing to repeat error. A pattern from another language may need the right flavour selected.
You pasted /pattern/g
Type only what is between the slashes and use the flag buttons. A pattern starting with / is searched for a literal slash.
Emoji split in two
Without the u flag, an emoji is two JavaScript characters and . matches half of it. Turn on u.
Regex tester free and private: nothing uploaded
The page is a regex tester free for everyone to use, with no sign-up. Your pattern and test text are processed by a worker inside your own browser and are never uploaded, so it is fine to paste real logs or data while you work.
Only a share link takes your pattern elsewhere, and only when you press Share and send the link to someone. If a run is stopped for taking too long, nothing is lost: change the pattern and it runs again.
What to do next
Once the pattern works, copy the snippet for your language and test it once in your project. For related jobs, the JSON Formatter tidies API responses you want to search, the Diff Checker compares text before and after a replace, and the Hash Generator makes checksums of the cleaned file.
Frequently asked questions
Is this regex tester free to use?
Yes. There is no sign-up and nothing to install. It runs in your browser, so you can use it as often as you like.
Can I use the regex tester online without installing anything?
Yes. Open the page and type a pattern; it works in any current browser on Windows, macOS, Linux, Android or iOS. Nothing needs to be installed, and the page keeps working while you type.
Is this a regex tester JavaScript developers can rely on?
Yes. Matching uses your browser's own JavaScript RegExp engine, so results are the same as in your front-end code and in Node.js on the same engine. Modern features such as named groups, lookbehind and the s, u and d flags are all available.
Does it work as a regex tester Python developers can use?
Mostly. Choose Python as the flavour and named groups, (?P=name), \A, \Z and leading inline flags are converted, but the test still runs in JavaScript. Python needs fixed-width lookbehind and has no \p{L} in re, so run the final pattern once in Python.
Is it a good regex tester for Java code?
For most patterns, yes. Atomic groups, possessive quantifiers, \Q…\E and \A or \z are converted or approximated with notes. Remember to double backslashes in Java strings and to add Pattern.MULTILINE or Pattern.DOTALL yourself.
Can I use it as a regex tester for C# and .NET?
Yes for common patterns, which .NET writes the same way as JavaScript. Balancing groups and conditionals cannot be converted or tested here. The C# tab writes a verbatim string with RegexOptions.IgnoreCase when the i flag is on.
How does the regex tester with replace mode handle $1 and $<name>?
Choose Replace and type a replacement: $1 inserts group 1, $<name> a named group and $& the whole match. Turn on the g flag to replace every match, not just the first. The result can be copied with one click.
What does the regex tester with capture groups show for each match?
The table shows the match number, the matched text, its start and end position, and every group by number or by name. A dash means the group did not take part. With the d flag the start of each group is shown too.
Is it a full regex tester and debugger?
It explains each part of the pattern in plain English, shows every match with positions and groups, and times each run. It does not step through the engine's backtracking one move at a time, but those details find most bugs quickly.
What can this regex tester tool not do?
It cannot run Python, PCRE, Java, .NET or Go engines directly, so results for those languages are usually the same but not guaranteed. Conditionals, recursion and .NET balancing groups cannot be tested. The library patterns are practical checks, not full validators.
What do the flags g, i, m, s, u, y and d mean?
g finds all matches, i ignores case, m makes ^ and $ work per line, and s lets the dot match line breaks. u turns on Unicode mode, y makes matching sticky, and d records group positions.
Why did my pattern stop with a message about catastrophic backtracking?
The pattern took longer than 1.5 seconds on this text, so the page stopped it to keep your browser responsive. This usually comes from nested quantifiers like (a+)+ or (.*)*. Remove the nesting or make the pattern more specific.
Why does the match count show a plus sign?
The counter stops at 5,000 matches and shows 5000+. The table lists the first 500 rows. For more, narrow the pattern or test a shorter part of the text.
How does the share link work, and is my text sent anywhere?
The link stores the pattern, flags and up to 1,500 characters of text after the # sign, which browsers do not send to the server. Anyone who has the link can read it, so do not share secrets. Without a share link, nothing leaves your browser.
Why do I see Error in the pattern?
The browser could not compile the expression, and the message gives the reason, such as an unterminated group or an invalid escape. If the pattern comes from another language, choose that flavour so its syntax is converted first.
Can I export the matches?
Yes. Press CSV above the match table to download regex-matches.csv with one row per match and one column per group. It opens in Excel, Google Sheets or any text editor.
Why does Replace change only the first match?
The g flag is off. Without it, JavaScript replaces only the first match, and the page shows a reminder under the result. Turn on g to replace them all.
Why does lookbehind work here but fail in Python or Java?
JavaScript allows lookbehind of any length. Python requires a fixed width and Java a bounded length, so (?<=\w+) works here but not there. Rewrite the lookbehind with a fixed length or use a capture group instead.
Does it support Unicode classes like \p{L}?
Yes, with the u flag on. \p{L} matches any letter and \p{N} any number in any script. Note that JavaScript's \w and \d stay ASCII only, even with u.
Can it check that an email address is real?
No pattern can. The email pattern in the library checks the shape of an address, such as [email protected], but only sending a message proves it exists.
Why does my pattern work here but fail in Go?
Go uses RE2, which has no lookahead, lookbehind or backreferences. This page supports them, so test Go patterns without those features. Go's named groups (?P<name>…) are converted for testing.
Test a pattern now
Live highlighting, groups, replace, split, a plain-English explanation and code for six languages. Free, private and run on your device.
Back to the toolLast updated October 2026 · Written and maintained by the FlipMyFormat team