We use cookies.This website uses essential cookies to operate core features. With your consent, we also use analytics cookies to understand traffic and improve the service. For more details, see our .
Was this tool helpful to use?
Your feedback helps us make it better
Test and debug JavaScript regular expressions in real-time, with detailed match results, capture groups, and index information.
g
i
m
s
u
y
Enter both a regex pattern and input text
Overview
Understand what the tool solves, how it works, and the boundaries of its data.
Use this JavaScript regex tester to enter a pattern, choose flags, and compare it with sample text. The matching behavior follows JavaScript’s RegExp engine. A regular expression is a pattern that searches text for matching character sequences; flags change how a pattern is applied. The results show match details and captured groups, and Replace mode previews the resulting text.
Enter the pattern without surrounding slash marks, then add text that should match and text that should not. Start with a small example that isolates the rule you are checking. For instance, to find a sequence of digits, try \d+ against Order 48, item 7. Review the highlighted spans and match list, then add edge cases such as an empty value, punctuation, or a line break.
Guide
Follow the workflow and verify inputs and outputs with practical examples.
Type the expression body, such as \d+, without the opening and closing slash delimiters used in JavaScript source code. Invalid syntax is reported as an error instead of a match result.
Use sample text containing both expected matches and near-misses. For a date-like pattern, include a valid-looking value and a value with a missing digit so you can see whether the rule is too broad.
Turn on the available options such as global, ignore case, multiline, dotAll, Unicode, or sticky to change matching behavior. For example, global finds successive matches; without it, the pattern is not set to find every occurrence.
Inspect match locations, highlighted text, and any capture groups. A capture group is a parenthesized part of a pattern whose matched text can be viewed separately.
Switch to Replace, enter replacement text, and check the resulting string before using the pattern in code. Try a short example first to confirm the intended portion changes.
Use cases
See how the tool fits into real work and everyday tasks.
Check that a pattern compiles with the syntax and flags used by JavaScript before adding it to a script or application.
Use groups to isolate parts of a matched string, then confirm in the results that each group captures the intended characters.
Test a replacement on representative input and inspect the preview for accidental changes before applying equivalent logic to real data.
Q&A
Find concise answers to common questions and confusing cases.
No. It evaluates patterns using JavaScript RegExp behavior. Syntax and flags can differ across languages and regex engines, so retest in the exact runtime where the pattern will be used.
Check whether the global option is enabled. Without a global search, matching may stop after the first occurrence.
Parentheses can group part of a pattern. When a match is found, the result details let you inspect the full match and its captured portions.
It shows a replacement result for the text you entered so you can review it. Use a small sample and verify the output before applying a replacement to original data elsewhere.
Notes
Review scope, result limitations, and important precautions before use.
A passing example does not prove that a pattern handles every possible input. Test positive and negative cases, boundary conditions, and the same JavaScript environment used by your application. Avoid pasting confidential or personal data into any online form.
Related
Discover related tools, collections, and available API capabilities.