Use Nimzoa's free online Regex Tester to test JavaScript regular expressions against sample text and see matching results instantly. Enter a regex pattern, choose flags such as global or case insensitive matching, and inspect highlighted matches, capture groups, and match positions. You can also preview find and replace results, try ready made examples, and copy matching text. Patterns and test data are processed locally in your browser without uploading your input.
BROWSER-ONLY DEVELOPER TOOL
Test JavaScript regular expressions against text, inspect captures and preview replacements without uploading your input.
01 / PATTERN & INPUT
JavaScript regex only (not PCRE). Enable g to enumerate matches; y is sticky at the current position. Positions are zero-based UTF-16 offsets. Test text is limited to 10,000 characters.
02 / LIVE RESULTS
Patterns and text stay in temporary browser memory. Untrusted regexes run in a disposable Worker with a 1.2-second timeout; no text is uploaded or stored.
Enter a JavaScript regular expression without the surrounding / delimiters in the pattern field.
Select the regex flags you need, then paste or type sample text to evaluate locally in your browser.
Review highlighted matches, capture groups, UTF-16 positions, and the optional replacement preview.
Nimzoa's Regex Tester is a free online regular expression testing tool designed for developers, students, data analysts, and anyone working with text patterns. It uses JavaScript regular expression syntax to identify matching text, inspect capture groups, and preview replacement results directly in your browser. The interactive regex editor supports JavaScript flags including global (g), case-insensitive (i), multiline (m), dotAll (s), Unicode (u), and sticky (y). Matching results are highlighted in the original text, making it easier to understand how a regular expression behaves with different inputs and flag combinations. The tool displays match counts, captured values, named capture groups, and zero-based UTF-16 match positions. It also provides a find and replace preview using JavaScript replacement syntax, including numbered and named capture references. Built in examples for email addresses, hashtags, and named dates help users explore common regular expression patterns. Matches and replacement output can be copied for use in other applications. Regex evaluation takes place locally in an isolated browser Web Worker. The tool includes a 1.2 second evaluation timeout and a 10,000 character test-text limit to help manage potentially expensive patterns. Your entered patterns and text are not uploaded or stored by the tool. Nimzoa uses JavaScript regular expressions rather than PCRE, so syntax and behavior may differ from regex engines used in Python, PHP, or other programming languages. This free browser based Regex Tester is useful for exploring regex behavior, troubleshooting patterns, testing text matching, and understanding capture groups without installing additional software.
Nimzoa's free online Regex Tester makes JavaScript regular expression testing easier with live match highlighting, match counts, capture group inspection, and replacement previews in one browser based workspace. It supports six JavaScript regex flags, numbered and named capture groups, and zero-based UTF-16 match positions for precise pattern analysis. Built in examples for emails, hashtags, and named dates help users explore common matching tasks, while copy options make it convenient to reuse matching text and replacement results. The tool processes patterns and test data locally without requiring an account, installation, or server side conversion. An isolated Web Worker, evaluation timeout, and input length limit help manage potentially expensive regex operations. It is a practical solution for developers, students, and technical users who need to test regular expressions online, inspect matching behavior, and troubleshoot JavaScript regex patterns.
Your regular expressions and test text are evaluated locally in your browser using an isolated Web Worker. Nimzoa's Regex Tester does not upload, log, or store the patterns or text entered into the tool. Evaluation runs on your device, with a 1.2 second timeout and a 10,000 character test text limit to help manage resource intensive patterns. The results remain in your browser, and no account or server-side regex processing is required.
A regex tester is a tool that evaluates regular expressions against sample text. Nimzoa's free online Regex Tester highlights JavaScript regex matches, displays capture groups and positions, and previews text replacements directly in your browser.
Enter a JavaScript regex pattern without surrounding slash delimiters, select the required flags, and add sample text. Nimzoa displays matching results, capture groups, and positions automatically.
Yes. Nimzoa's Regex Tester is free to use without registration or software installation. You can test patterns, inspect matches, and preview replacements in your browser.
Nimzoa uses JavaScript regular expression syntax. It does not use PCRE, so some patterns written for Python, PHP, or other regex engines may require modification.
The g flag enables global matching, i ignores case, m changes line-boundary assertions, s allows dots to match line terminators, u enables Unicode-aware behavior, and y enables sticky matching at the current position.
Yes. The tool displays numbered and named capture groups for matching results. It can also show zero-based UTF-16 start and end positions.
Yes. JavaScript named capture syntax can be used to extract labeled values. Nimzoa displays the resulting named groups in the match details.
Yes. Enter replacement text to preview JavaScript regex replacement behavior. The tool supports JavaScript replacement references, including numbered and named capture groups.
The global flag may be disabled. Enable g to enumerate multiple matching occurrences, then review the highlighted matches and the match count.
Common causes include incorrect escaping, case sensitivity, unsupported syntax, misplaced anchors, or unexpected character classes. Simplify the pattern and test it against a short example.
You can test patterns that identify email like strings, but a regex match does not prove that an email address exists or is deliverable. Comprehensive validation may require additional checks.
JavaScript string positions are measured in UTF-16 code units. Nimzoa displays zero-based match offsets, with the end position exclusive. Emoji and certain Unicode characters may occupy more than one code unit.
Some patterns can require excessive computation. Nimzoa evaluates regex in an isolated Web Worker with a 1.2 second timeout and a 10,000 character text limit to help manage expensive operations, although these safeguards cannot eliminate every risk.
No. Nimzoa processes the entered patterns and text locally in your browser. The Regex Tester does not upload, log, or store your submitted input for evaluation.
JavaScript and PCRE are different regular expression engines. They share many basic features but differ in supported syntax, flags, and certain matching behaviors. Nimzoa specifically tests JavaScript regular expressions.
A regular expression, commonly called regex, is a pattern used to search, match, and manipulate text. Developers use regular expressions to identify email-like strings, find repeated words, extract information, and perform advanced search-and-replace operations.
Nimzoa's free online Regex Tester lets you test JavaScript regular expressions against sample text directly in your browser. It highlights matches, displays capture groups, identifies match positions, and previews text replacements without uploading your input.
Whether you're learning regex for the first time or troubleshooting a complex JavaScript pattern, this guide explains regular expression syntax, flags, matching behavior, replacement operations, and practical examples.
A regex tester is an interactive tool for checking how a regular expression behaves against sample text.
Instead of repeatedly modifying application code, you can enter a pattern, supply test text, and inspect the results.
A JavaScript regex tester evaluates expressions using the regular expression features supported by the browser's JavaScript engine.
Common uses include:
Find specific words, numbers, or text patterns.
Test case-sensitive and case-insensitive matching.
Extract portions of text using capture groups.
Identify matching positions in a string.
Test global and sticky matching behavior.
Preview find-and-replace operations.
Troubleshoot patterns that return unexpected matches.
Experiment with JavaScript regular expression flags.
Explore common patterns using example text.
Regex testing is particularly useful when working with JavaScript applications, text processing, form inputs, log files, and structured strings.
Regular expressions can behave unexpectedly when special characters, quantifiers, flags, or grouping rules are misunderstood.
For example, a pattern may match only the first occurrence when you expected every occurrence. A broad quantifier may capture more text than intended, while an incorrectly escaped character may change the meaning of the expression.
Testing against representative text helps reveal these problems before a pattern is used in an application.
The following examples demonstrate common JavaScript regex operations.
Field | Example |
|---|---|
Regex pattern | \d+ |
Flags | g |
Test text | Order 123 contains 45 items. |
Match 1 | 123 |
Match 2 | 45 |
Total matches | 2 |
The \d token matches an ASCII digit in JavaScript, while + matches one or more consecutive occurrences.
The global flag allows both numeric sequences to be identified.
Field | Example |
|---|---|
Regex pattern | hello |
Flags | gi |
Test text | Hello world, HELLO again. |
Match 1 | Hello |
Match 2 | HELLO |
Total matches | 2 |
The i flag enables case-insensitive matching. The g flag allows multiple occurrences to be found.
Without the i flag, the lowercase pattern would not match these uppercase and mixed-case examples.
Field | Example |
|---|---|
Regex pattern | \b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b |
Flags | g |
Test text | Contact [email protected] or [email protected] |
Match 1 | |
Match 2 | |
Total matches | 2 |
This pattern demonstrates how regular expressions can identify strings that resemble email addresses.
It is not a complete email validation system. Real email address rules are more complex, and a regex match does not prove that an address exists or can receive messages.
Field | Example |
|---|---|
Regex pattern | #[A-Za-z0-9_]+ |
Flags | g |
Test text | Learning #JavaScript and #Regex101 |
Match 1 | #JavaScript |
Match 2 | #Regex101 |
Total matches | 2 |
This simple pattern matches hashtags containing ASCII letters, digits, and underscores.
It does not cover every Unicode hashtag convention used by social platforms.
Field | Example |
|---|---|
Regex pattern | (\d{4})-(\d{2})-(\d{2}) |
Test text | Published: 2026-11-12 |
Full match | 2026-11-12 |
Group 1 | 2026 |
Group 2 | 11 |
Group 3 | 12 |
Parentheses create capture groups.
The first group captures the year, the second captures the month, and the third captures the day.
This pattern checks the numeric structure but does not verify whether the date is valid. For example, it can also match an impossible month or day.
Regular expressions combine ordinary characters with special tokens that describe matching rules.
Understanding these tokens makes it easier to create accurate patterns.
Syntax | Meaning | Example |
|---|---|---|
. | Any character except line terminators unless dotAll is enabled | a.c |
\d | ASCII digit | \d+ |
\D | Non-ASCII-digit character | \D+ |
\w | Word character under JavaScript matching rules | \w+ |
\s | Whitespace character | \s+ |
^ | Start assertion | ^Hello |
$ | End assertion | world$ |
* | Zero or more repetitions | a* |
+ | One or more repetitions | a+ |
? | Zero or one repetition | colou?r |
{n} | Exactly n repetitions | \d{4} |
{n,m} | Between n and m repetitions | \d{2,4} |
[] | Character class | [A-Z] |
() | Capturing group | (abc) |
| | Alternation | cat|dog |
\b | Word boundary | \bcat\b |
Some tokens have additional behavior under Unicode-aware matching. Always test patterns against the kinds of characters your application expects.
Most ordinary letters and digits match themselves.
Special regex characters have different meanings and often require escaping when you want to match them literally.
For example:
Goal | Pattern |
|---|---|
Match a literal period | \. |
Match a literal plus sign | \+ |
Match an opening parenthesis | \( |
Match a literal question mark | \? |
Match a backslash | \\ |
Incorrect escaping is a common reason a regex matches unexpected text.
JavaScript regular expressions support flags that modify how patterns are evaluated.
Nimzoa exposes six commonly used flags.
Flag | Name | Purpose |
|---|---|---|
g | Global | Find successive matches |
i | Ignore case | Perform case-insensitive matching |
m | Multiline | Make ^ and $ work at line boundaries |
s | dotAll | Allow . to match line terminators |
u | Unicode | Enable Unicode-aware matching behavior |
y | Sticky | Match at the current lastIndex position |
The global flag is useful when the same pattern may appear multiple times.
For example:
Field | Example |
|---|---|
Pattern | cat |
Flags | g |
Text | cat dog cat |
Matches | cat, cat |
Without global matching, an ordinary first-match search would return only the first occurrence.
The ignore-case flag allows a pattern to match text with different letter capitalization.
For example, hello with the i flag matches Hello, HELLO, and hello.
The multiline flag changes how the start and end assertions behave.
Without m, ^ and $ generally refer to the beginning and end of the input, subject to JavaScript's end-of-input rules.
With m, these assertions can also match positions at line boundaries.
Normally, the dot token does not match line terminators.
The s flag allows it to include them.
This is useful when testing patterns that span multiple lines.
The Unicode flag changes how the regular expression engine interprets certain Unicode patterns and escapes.
It is particularly relevant when working with Unicode code points and characters represented by surrogate pairs.
Sticky matching requires the next match to begin exactly at the regular expression's current lastIndex position.
Unlike global searching, it does not skip ahead to find a later occurrence.
This behavior is useful in tokenization and sequential parsing.
Yes. JavaScript allows compatible flags to be combined.
For example, gi enables global, case-insensitive matching.
The correct combination depends on the pattern and the intended result.
Capture groups allow a regular expression to extract specific parts of a match.
They are useful when a matching string contains multiple pieces of information.
Parentheses create numbered groups.
Consider:
Field | Value |
|---|---|
Pattern | (\d{4})-(\d{2})-(\d{2}) |
Input | 2026-11-12 |
Full match | 2026-11-12 |
Group 1 | 2026 |
Group 2 | 11 |
Group 3 | 12 |
Capture-group numbering follows the order of opening parentheses.
Named groups make captured values easier to identify.
JavaScript supports the syntax (?<name>...).
For example:
Field | Value |
|---|---|
Pattern | (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) |
Input | 2026-11-12 |
Named group: year | 2026 |
Named group: month | 11 |
Named group: day | 12 |
Nimzoa displays numbered and named capture values in its match details.
A non-capturing group uses the syntax (?:...).
It groups parts of a pattern without creating an additional numbered capture.
For example, (?:cat|dog)s? matches cat, dog, cats, or dogs.
Non-capturing groups are useful when grouping is needed but the captured value is not.
Regular expressions are useful not only for finding text but also for transforming it.
Nimzoa includes a replacement preview that demonstrates JavaScript replacement behavior.
Field | Value |
|---|---|
Pattern | cat |
Flags | g |
Input | cat and cat |
Replacement | dog |
Result | dog and dog |
The global flag allows both occurrences to be replaced.
Field | Value |
|---|---|
Pattern | (\d{4})-(\d{2})-(\d{2}) |
Input | 2026-11-12 |
Replacement | $3/$2/$1 |
Result | 12/11/2026 |
JavaScript replacement references such as $1, $2, and $3 insert the corresponding captured groups.
Field | Value |
|---|---|
Pattern | (?<first>[A-Za-z]+) (?<last>[A-Za-z]+) |
Input | Alex Morgan |
Replacement | $<last>, $<first> |
Result | Morgan, Alex |
Named replacement references can make complex transformations easier to understand.
Token | Meaning |
|---|---|
$$ | Insert a literal dollar sign |
$& | Insert the complete match |
$1 | Insert the first capture group |
$2 | Insert the second capture group |
$<name> | Insert a named capture group |
$` | Insert text before the match |
$' | Insert text after the match |
Replacement tokens depend on the pattern and available capture groups.
Nimzoa's preview lets you inspect the result before using a replacement expression in your application.
When testing a regular expression, knowing where a match begins and ends can be as useful as knowing what matched.
Nimzoa displays zero-based UTF-16 positions.
Consider:
Field | Value |
|---|---|
Text | Hello 123 |
Pattern | \d+ |
Match | 123 |
Start position | 6 |
End position | 9 (exclusive) |
The first character begins at position zero.
An exclusive end position identifies the boundary immediately after the matched text.
JavaScript strings use UTF-16 code units for indexing.
Some characters, including many emoji, occupy two UTF-16 code units rather than one.
For example, the string 😀A contains two visible characters but has a JavaScript string length of three UTF-16 code units.
Therefore, match positions may differ from visual character counts.
This distinction matters when using regex results with JavaScript string operations.
A regex tester and a validator are related, but they are not identical.
A regex tester shows how a pattern matches sample input.
A validator checks whether an entire value satisfies a defined rule.
Goal | Regex pattern | Explanation |
|---|---|---|
Find digits anywhere | \d+ | Matches a numeric sequence |
Require digits only | ^\d+$ | Requires the whole nonempty input to contain ASCII digits |
Require exactly four digits | ^\d{4}$ | Requires a four-digit value |
Anchors are important when validating an entire string.
However, JavaScript's $ assertion can also match before a final line terminator. For strict full-input validation, consider that behavior and test edge cases.
A regex match does not automatically establish that a value is valid for a real-world purpose.
For example, matching a date-shaped string does not prove that the date exists.
Regular expression engines do not all support exactly the same syntax and behavior.
Nimzoa uses JavaScript regular expressions.
Feature | JavaScript Regex | PCRE | Python re |
|---|---|---|---|
Basic character classes | Yes | Yes | Yes |
Capture groups | Yes | Yes | Yes |
Named capture syntax | (?<name>...) | Supports (?<name>...) | (?P<name>...) |
Lookahead assertions | Yes | Yes | Yes |
Lookbehind assertions | Supported in modern JavaScript | Yes | Supported, with restrictions |
Engine-specific features | Yes | Yes | Yes |
Syntax fully interchangeable | No | No | No |
A pattern that works in one engine may require changes before it works in another.
Possible causes include:
Unsupported engine-specific constructs.
Different named-group syntax.
Different escape handling.
Different Unicode behavior.
Different matching or flag semantics.
When using Nimzoa, test patterns intended for JavaScript rather than assuming compatibility with PCRE, PHP, Python, or other engines.
Quantifiers control how many times a pattern component can match.
By default, common JavaScript quantifiers are greedy, meaning they attempt to consume as much matching text as possible while allowing the overall pattern to succeed.
Adding ? after a quantifier can make it lazy.
Field | Value |
|---|---|
Input | <b>One</b><b>Two</b> |
Greedy pattern | <b>.*</b> |
Greedy result | <b>One</b><b>Two</b> |
Lazy pattern | <b>.*?</b> |
First lazy match | <b>One</b> |
Greedy and lazy quantifiers are important when working with repeated delimiters.
However, regex is not a general replacement for a proper HTML parser. Complex or malformed HTML should be processed with an appropriate parser.
Check whether the pattern contains incorrect escaping, unsupported syntax, or unexpected anchors.
Also verify whether case sensitivity is preventing a match.
Use a short test string to isolate the problem.
The global flag may not be enabled.
Enable g when you want to enumerate multiple matching occurrences.
A greedy quantifier such as .* may be consuming more text than intended.
Consider a lazy quantifier or a more specific character class.
A group may be optional, may not have participated in the match, or may be incorrectly positioned.
Inspect the full match and the relevant group boundaries.
Check numbered and named capture references, the selected flags, and the replacement syntax.
Remember that JavaScript replacement strings have special tokens such as $1, $&, and $<name>.
JavaScript reports string positions in UTF-16 code units.
Emoji and other supplementary Unicode characters can occupy two code units.
This can make reported positions differ from the number of visible characters.
Some regular expressions can require excessive computation on particular inputs.
Nested ambiguous quantifiers and certain overlapping alternatives may cause catastrophic backtracking.
Nimzoa uses an isolated Worker with a 1.2-second evaluation timeout to help manage expensive patterns.
If a pattern times out, simplify it, reduce ambiguous repetition, or test against shorter input.
Python and JavaScript use different regular expression engines and have syntax differences.
Review named-group syntax, escapes, supported constructs, and flags.
No. A simple regex can identify common email-like formats, but comprehensive email validation involves more than matching text.
It may require application-specific rules and, where appropriate, verification of the address.
Some regex patterns can consume substantial processing time when evaluated against carefully chosen input.
This problem is often associated with regular expression denial of service, or ReDoS.
Certain combinations of nested quantifiers, ambiguous alternatives, and long input strings can cause a backtracking engine to explore many possible matching paths.
For example, patterns with nested repetition may perform poorly when the input almost matches but fails near the end.
Avoid unnecessary nested quantifiers.
Use specific character classes when possible.
Reduce ambiguous alternatives.
Anchor patterns when appropriate.
Test against realistic and difficult inputs.
Apply suitable input-length limits.
Use timeouts or other safeguards where supported.
Avoid assuming that a regex is safe simply because it works on short input.
Nimzoa's Regex Tester includes a 10,000-character text limit and a 1.2-second Worker evaluation timeout.
These safeguards help limit expensive evaluations, but they do not guarantee that every possible regex performance problem is eliminated.
Privacy depends on how an online regex tester processes the supplied text.
Some tools may transmit input to a remote service, while others perform matching locally.
Nimzoa evaluates regex patterns and test text in your browser using a Web Worker.
The tool does not upload or store your entered patterns and text for regex evaluation.
Browser-local processing is useful when working with sample data that you prefer not to submit to a remote regex service.
Nevertheless, follow your organization's data-handling policies and avoid entering unnecessary sensitive information.
A well-designed regex should be accurate, understandable, and appropriate for the task.
Begin with the smallest expression that matches the intended text.
Add complexity only when the requirements demand it.
Include positive examples that should match and negative examples that should not.
Testing only successful cases can hide overly broad patterns.
The g, i, m, s, u, and y flags change matching behavior.
Use only the flags needed for the intended operation.
Specific character classes can make patterns more predictable than broad wildcard matching.
For example, [0-9] communicates a narrower intent than .*.
Named capture groups can make extracted information easier to understand.
Avoid unnecessary capturing groups when you only need grouping.
JavaScript regex behavior can vary depending on Unicode-aware matching and the characters in the input.
Test multilingual text and supplementary Unicode characters when relevant.
Evaluate complex patterns against both normal and difficult inputs.
Pay particular attention to ambiguous repetition.
Matching a text pattern is not the same as proving that a real-world value is valid.
For dates, emails, identifiers, and other structured values, apply additional validation when necessary.
An online regex tester is useful whenever you need to inspect text-matching behavior quickly.
Test patterns before incorporating them into JavaScript functions or frontend applications.
Extract numbers, identifiers, dates, or selected text fragments.
Preview transformations using captured values and replacement references.
Explore patterns that may form one part of an application's validation rules.
Experiment with character classes, anchors, quantifiers, groups, and flags.
Review match positions and capture groups to understand why a pattern matches or fails.
Explore whether a pattern behaves reasonably on sample inputs, while recognizing that a quick test is not a comprehensive performance guarantee.
Regex testing often forms part of a larger developer workflow.
Useful complementary tools include:
JSON Formatter: Format and inspect JSON data.
JavaScript Minifier: Reduce unnecessary formatting in JavaScript source code.
HTML Formatter: Make HTML markup easier to read.
JavaScript Formatter: Format JavaScript source code, where the tool is available in Nimzoa's published catalog.
These tools address different tasks and can complement regular expression testing during development.
Regular expressions are powerful tools for matching, extracting, and replacing text, but their syntax and behavior can become difficult to understand as patterns grow more complex.
Nimzoa's free online Regex Tester provides an accessible way to experiment with JavaScript regex patterns, inspect live matches, examine capture groups, and preview replacements directly in your browser.
With six JavaScript flags, highlighted results, named capture groups, UTF-16 match positions, built-in examples, and browser-local processing, it offers a practical environment for learning and troubleshooting regular expressions.
For reliable results, use representative sample text, understand the selected regex flags, and verify patterns against both expected and unexpected inputs.
Use the Regex Tester above to explore your JavaScript regular expressions and review matching behavior instantly.