Regex Tester Calculator
Enter a regular expression and sample text to see the matches.
Result
How it is calculated
The pattern is wrapped in slashes and run by a PCRE (Perl-compatible) regular-expression engine, so PCRE syntax applies, which differs from JavaScript or POSIX in places such as lookbehind and named groups. A bare slash in your pattern is escaped for you, and one you have already escaped (\/) is left alone, so both a/b and a\/b work. Only the flags i (ignore case), m (^ and $ match at each line), s (dot matches newline), x (extended, ignores whitespace) and u (UTF-8) are kept; any other letter, including g, is dropped.
The tool reports a status (match, no match or invalid pattern), the number of matches and a numbered list of the matched text. All matches are always found, so no global flag is needed. Only the whole match is listed, not the contents of capture groups, and at most 50 matches are shown, followed by an ellipsis. Pattern and text must both be filled in, otherwise there is no result.
Worked example
Find e-mail addresses in the sample text with the pattern \b[\w.+-]+@[\w-]+\.[\w.]+\b and the flag i. The scan goes left to right through Write to ann@example.com or bob.smith@mail.example.org, not to @home or info@. It finds ann@example.com first, then bob.smith@mail.example.org. The fragments @home and info@. have no characters on one side or no domain with a dot, so they fail. The status is Match, the count is 2, and the list shows the two addresses numbered 1 and 2.
Common mistakes
- Typing the pattern with delimiters and flags the way JavaScript shows it, such as
/abc/gi. The slashes become part of the pattern, so/abc/does not match the text abc; the flags go in their own field. - Expecting the list to show what each group captured. Only the full match is listed:
(a)(b)on ab lists just ab. Test groups by turning them into separate patterns. - Forgetting the
mflag when using ^ or $ on multi-line text: without it,^\w+finds only the first word of the entire text, with it the first word on each line. - Writing a pattern that can match an empty string, such as
x*. On the text abc it reports 4 matches, all empty, which is easy to misread as real hits. - Expecting case-insensitive matching without the
iflag, or relying ongto find all matches. Matching is case-sensitive unlessiis set, while all matches are found regardless.
About this calculator
This tool runs a regular expression against sample text using standard regex syntax — character classes, quantifiers (*, +, ?, {n,m}), anchors (^, $), and groups — and lists every match it finds along with a total count, letting you verify a pattern before dropping it into code. Regex engines vary slightly in their exact behavior (PCRE, JavaScript's RegExp, POSIX), so testing a pattern interactively catches edge cases like greedy versus lazy quantifiers or unescaped special characters before they cause a bug in production.
Developers validating form input, writing a log-parsing script, or building a URL router use a regex tester constantly, since regex syntax is notoriously easy to get subtly wrong — a pattern that matches your first three test cases can silently fail on the fourth. It's also a common teaching aid for learning regex, letting a student see exactly which parts of the text a pattern matches rather than reasoning about it purely on paper (this tool lists the whole matches, not the contents of individual capture groups).
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments