Skip to main content

Regex Tester

Test regular expressions against sample text online.

Regex Tester

Regex Tester

Online tool

Browser-only Testing…
Common regex patterns
Visual Regex Builder
Add common tokens without memorizing their syntax.
Builder pattern
/ /
Invalid Valid Enter a pattern to begin
Browser execution: JavaScript

Test String

Enter or paste text to test.

Ctrl/Cmd + Enter to test

Match Preview

Matching portions are highlighted.

Matches: Groups: Pattern: Flags:

Match Inspector

Indexes, line/column positions, capture groups and named groups.

No matches

Run a valid pattern against a test string.

Supports JavaScript replacement tokens such as $1, $2, $&, $`, $' and $<name>.

Regex Split

Split the test string using the current pattern as a delimiter.

No split results yet.
#ValueLength

Regex Test Suite

Define strings that should match or should not match.

Test summary

Pattern Diagnosis

Actionable checks for common mistakes and expensive patterns.

Pattern Explanation

Export Match Results

Export only the locally computed results.

Matches
Capture groups
Test length
Execution
Privacy
Runs in browser
✓
Browser-based processing

Regex execution, matching and replacement happen locally. Your pattern and test text are not sent to AabiTech.

⚡

Fast to use

Designed to help you complete the task without unnecessary steps.

◇

Works in your browser

No separate desktop software is needed for this online tool.

✓

Simple workflow

Enter your information, use the tool and work with the result.

What Is a Regex Tester?

A regex tester is an online tool for checking how a regular expression behaves against sample text. Instead of writing a small program just to see whether a pattern matches, you can enter the pattern, choose its flags, provide test text and inspect the results immediately.

AabiTech Regex Tester is designed specifically for JavaScript regular expressions. It uses the browser's native RegExp engine, making it useful when you are developing JavaScript, browser-based applications or Node.js code and want to test a pattern before adding it to your project.

The tester shows matched text, match counts, capture groups and match positions. It also provides replacement testing and individual test cases so you can check both strings that should match and strings that should not.

How to Test a Regular Expression Online

Testing a regex online is straightforward. Enter the regular expression pattern in the pattern field without the surrounding slash delimiters, then select the JavaScript flags required by your pattern.

  1. Enter your regular expression pattern.
  2. Select flags such as global, ignore case or multiline when needed.
  3. Enter or paste the text you want to test.
  4. Review the highlighted matches and match count.
  5. Open match details to inspect positions and capture groups.
  6. Use Replace when you want to preview a transformation using capture groups.
  7. Add test cases when you want to verify both matching and non-matching input.

For example, the pattern \d+ matches one or more digits. Testing it against Order 125 contains 3 items produces matches for 125 and 3.

JavaScript Regex Testing with RegExp

AabiTech's Regex Tester is a JavaScript regex tester. The tool uses the browser's native JavaScript RegExp implementation rather than pretending that all regular-expression engines behave identically.

This matters because regular-expression syntax can vary between programming languages and engines. A pattern intended for JavaScript should be tested with JavaScript-compatible syntax before it is placed into browser code or a Node.js application.

JavaScript supports features including character classes, quantifiers, capturing groups, named capturing groups, backreferences, lookahead and lookbehind assertions, Unicode features and several regex flags.

If your production code uses another regex flavor such as PCRE or Python's re engine, verify that the syntax is compatible before using the pattern there.

Regex Matches, Capture Groups and Named Groups

Finding a match is often only the first step. Capture groups allow a regex to identify useful parts of a larger match. For example, the pattern (\d{4})-(\d{2})-(\d{2}) can capture the year, month and day separately from an ISO-style date.

AabiTech displays capture groups for individual matches so you can see exactly which part of the pattern produced each captured value.

JavaScript also supports named capture groups. A pattern such as (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) gives the captured values meaningful names instead of requiring you to remember only their numeric positions.

Named groups are especially useful when a regular expression extracts structured information from dates, URLs, logs, identifiers or other semi-structured text.

Understanding Regex Flags

Regex flags change how a JavaScript regular expression searches and interprets text. AabiTech provides the commonly used JavaScript flags directly in the tester.

  • g — global matching, allowing the expression to find multiple matches.
  • i — case-insensitive matching.
  • m — multiline behavior for line boundaries.
  • s — allows the dot character to match line terminators.
  • u — Unicode-aware matching.
  • y — sticky matching from the current position.
  • d — provides match indices where supported by the browser.
  • v — enables the newer JavaScript Unicode Sets behavior where supported.

For example, use the g flag when you want to find every occurrence of a pattern instead of stopping at the first match. Use i when letter case should not affect matching.

Testing Regex Patterns with Test Cases

A regex can appear to work while still accepting incorrect input or rejecting valid input. Test cases make it easier to check both sides of a validation rule.

Use the AabiTech Test Cases area to add sample values that should match and values that should not match. Each case is evaluated against the current JavaScript regular expression and reported as passed or failed.

For an email-style expression, for example, you might test student@example.com as a value that should match and not-an-email as a value that should not match.

Testing positive, negative and edge-case examples is especially useful before moving a regular expression into form validation, data processing or application code.

Using Regex Replace and Capture Groups

Regular expressions are useful for transforming text as well as finding it. AabiTech's Replace mode lets you preview the result of replacing regex matches with replacement text.

JavaScript replacement patterns can reference capture groups using tokens such as $1 and $2. The complete match can be referenced with $&, while named groups can be referenced with $<name>.

For example, the pattern (\d{4})-(\d{2})-(\d{2}) can be combined with the replacement $2/$3/$1 to transform an ISO-style date into month/day/year order.

Previewing replacement output before putting it into application code helps catch incorrect capture-group numbering and replacement syntax.

Common Regex Patterns and Examples

Common regular-expression tasks include finding email-like addresses, phone numbers, URLs, dates, IP addresses, hashtags, usernames and numbers inside larger text.

AabiTech includes ready-made examples for several of these tasks so you can start with a working pattern and modify it for your own requirements.

For example, a simple email-style pattern can be used to locate addresses inside a text sample, while a date pattern such as \b\d{4}-\d{2}-\d{2}\b can locate dates in YYYY-MM-DD format.

These examples are intended for testing and learning. A regular expression that works for one application's input rules may not be sufficient for every possible real-world value, so always test patterns against the data your application actually receives.

Regex for Validation and Text Extraction

Regular expressions are commonly used for two related jobs: validation and extraction.

Validation checks whether an entire value follows a required format. For example, a pattern anchored with ^ and $ can be used to test whether a username or slug follows a defined structure.

Extraction searches a larger body of text and identifies useful pieces such as email addresses, dates, URLs, order identifiers or log values. The global flag is often useful when multiple values need to be found.

The Regex Tester supports both workflows by providing match highlighting, match counts, capture groups, match positions and reusable test cases.

Browser-Based Regex Processing and Data Privacy

Regex testing can involve source code, logs, identifiers or other text that you may not want to upload to a remote service. AabiTech performs regex processing in your browser for this tool, so the pattern and test text do not need to be sent to AabiTech's server for matching.

This browser-based approach also avoids a server round trip for normal regex testing and keeps the interaction responsive.

Although browser processing reduces the need to transmit your input, you should still follow your organization's data-handling policies when working with sensitive information.

Questions & answers

Frequently Asked Questions

What is a regex tester?
A regex tester is a tool that lets you run a regular expression against sample text and inspect the matches. It is useful for checking syntax, validating patterns, extracting text and debugging regular expressions before using them in application code.
How do I test a regex online?
Enter the regex pattern, select the required flags, paste or type your test text and run the test. AabiTech highlights the matches and shows match counts, positions and capture groups. You can also add positive and negative test cases.
What regex engine does AabiTech use?
AabiTech Regex Tester uses the browser's native JavaScript RegExp engine. This makes it particularly suitable for testing regular expressions intended for JavaScript and browser-based applications.
Can I test JavaScript regular expressions online?
Yes. AabiTech is designed for JavaScript regular expressions and supports JavaScript regex syntax and flags provided by the browser's RegExp implementation.
What do the regex flags g, i, m and s mean?
The g flag enables global matching, i makes matching case-insensitive, m changes the behavior of line anchors such as ^ and $, and s allows the dot character to match line terminators. The tester also provides other JavaScript flags where supported.
What is a regex capture group?
A capture group is a part of a regular expression enclosed in parentheses. It records the corresponding portion of a match so it can be inspected or reused in a replacement. For example, (\d+) captures a sequence of digits.
What are named capture groups in regex?
Named capture groups give a meaningful name to a captured part of a regular expression. JavaScript uses syntax such as (?pattern). Named groups can make extracted data easier to understand than relying only on numeric group positions.
Can I test regex replacement online?
Yes. Use the Replace mode to preview how JavaScript replacement text transforms your input. Replacement tokens such as $1, $2 and $ can be used with capture groups.
Can I test multiple regex cases?
Yes. Add multiple test cases and mark each one as expected to match or expected not to match. The tester evaluates the cases against the current regular expression and reports the results.
Why is my regex not matching?
Common causes include an incorrect pattern, missing anchors, an unsuitable character class, incorrect flags, case differences, unexpected whitespace or differences between the regex flavor used by your code and the tester. Check the pattern, flags and exact test text carefully.
Can I test an email regex?
Yes. The tester includes an email example that can be used as a starting point. You can replace the sample text with your own test values and use the match results and test cases to check the behavior of your expression.
Can I test a URL regex?
Yes. A URL example is available in the pattern examples. You can modify the expression and test it against the exact URL formats your application needs to recognize.
Can I use regex for text extraction?
Yes. Regular expressions can extract repeated values from larger text. Use the global flag to find multiple matches and capture groups when you need to extract specific parts of each match.
Is my regex test data uploaded to AabiTech?
Regex matching is performed in your browser, so your pattern and test text do not need to be uploaded to AabiTech's server for normal testing. You should still follow your own organization's policies when handling sensitive information.

Explore more AabiTech tools

Browse the complete collection of practical online tools for development, text, design, calculations and everyday digital work.