Regex Tester Online — Free, Runs in Your Browser
Test regular expressions live — instant match highlighting, capture groups and the g, i, m and s flags. A free regex checker that runs entirely in your browser.
Last updated:
Was this tool useful?
Use the tool above and you can rate it here.
How to use the regex tester
- Enter your regular expression pattern in the top field (without the surrounding slashes).
- Toggle flags as needed: i for case insensitive, m for multiline, s for dotall.
- Paste your test string in the text area below.
- Matches are highlighted in yellow instantly. The match list shows each match, its position, and any capture groups.
Common regex patterns
\d+— one or more digits[a-zA-Z]+— one or more letters\b\w+\b— whole words^.+$— entire non-empty line (with m flag)[\w.+-]+@[\w-]+\.[a-z]+— basic emailhttps?://[^\s]+— URLs\d{3}-\d{4}— a 7-digit phone number such as 555-0123
JavaScript regex flavour
This tester uses JavaScript's built-in RegExp engine — the same one your browser and Node.js use. Patterns that work here will work in JavaScript code directly, as documented in MDN's JavaScript regular expressions guide. Note that JavaScript does not support lookbehind in older browsers, named capture groups require ES2018+, and the s (dotall) flag requires ES2018+.
Who uses an online regex tester
Backend developers test form validation patterns for email addresses, phone numbers, and PIN codes before embedding them in server-side code. Frontend engineers prototype input sanitisation logic directly in the browser without switching to an IDE. Security researchers use it to analyse log patterns and extract IP addresses, user agents, or error codes from large log strings. Data engineers write regex patterns to parse semi-structured text from CSVs or API responses before loading into a database. Students learning regular expressions use it to experiment with patterns against real strings and immediately see how flags like i and m change behaviour.
Lookahead and lookbehind in JavaScript
JavaScript supports both positive and negative lookahead ((?=...) and (?!...)) and positive and negative lookbehind ((?<=...) and (?<!...)). Lookbehind requires ES2018 or later but is supported in all modern browsers. Example: (?<=₹)\d+ matches a number only when preceded by the ₹ symbol — useful for extracting amounts from financial text without capturing the currency symbol itself. Test lookaround patterns here to confirm they work as expected before using them in production.
Tips for debugging regex patterns
Start with the simplest possible pattern and build up incrementally. If a pattern is not matching, check for: unescaped special characters (a raw . matches any character — use \. for a literal dot); missing the m flag when anchoring to line boundaries with ^ and $; greedy vs lazy quantifiers swallowing more than expected. Use named capture groups ((?<year>\d{4})) to make complex patterns self-documenting.
Frequently asked questions
- What is a regular expression?
- A regular expression (regex) is a pattern that describes a set of strings. It's used to search, match, extract, validate, and replace text. For example, /\d+/ matches one or more digits, and /^[a-z]+$/i matches strings containing only letters.
- What flags are supported?
- This tester supports three flags: i (case insensitive — A matches a), m (multiline — ^ and $ match line boundaries, not just string boundaries), and s (dotall — . matches newlines too). The g (global) flag is always on so all matches are found.
- How do I match a literal dot or parenthesis?
- Escape it with a backslash: \. matches a literal dot, \( matches a literal opening parenthesis. In a regex pattern, characters like . * + ? [ ] { } ( ) ^ $ | \ have special meaning and must be escaped if you want them literally.
- How do capture groups work?
- Wrap part of your pattern in parentheses to create a capture group. For example, /(\d{4})-(\d{2})-(\d{2})/ matches a date and captures year, month, and day as separate groups. The match list shows captured groups in the Groups column.
- What's the difference between greedy and lazy matching?
- Greedy quantifiers (*, +, ?) match as much as possible. Lazy quantifiers (*?, +?, ??) match as little as possible. For example, /<.+>/ on '<b>text</b>' matches the whole thing. /<.+?>/ matches '<b>' and '</b>' separately.
- How do I match the start or end of a line with regex?
- Use the anchors: caret (^) matches the start and dollar ($) matches the end. By default they anchor the whole string; enable the m (multiline) flag to make them match at every line break. Example: ^Error matches lines that begin with 'Error' when multiline is on.
- How do I match an exact number of characters or repetitions?
- Use quantifier braces: a{3} matches exactly three a's, \d{2,4} matches two to four digits, and .{10,} matches ten or more of any character. Combine with anchors to enforce total length: ^.{8,16}$ validates an 8–16 character string.
From the blog
- Regex in 8 Steps: Patterns Every Developer Actually Uses
Learn regex patterns step by step, from literal characters to lookaheads, with 12 real-world patterns to copy into production and the mistakes that break them.
- Regex Cheat Sheet: Patterns Every Developer Needs
A practical regex cheat sheet: character classes, quantifiers, groups, lookaheads and the 12 most useful everyday patterns, with live examples.
- Developer Tools for Beginners: 12 Browser Utilities
Developer tools for beginners: 12 browser utilities that need no install, handle tasks you'd otherwise Google, and work on any device.
Related tools
- Regex Cheat Sheet
Quick reference for regular expressions: anchors, character classes, quantifiers, groups, lookarounds, flags, and ready-to-use patterns.
- regex101 Alternative
A simple regex101 alternative: Stax Regex Tester checks JavaScript regex in your browser with live match highlighting. For other engines, regex101 does more.
- Diff Checker Online — Compare Text Free, No Upload
Compare two texts or code snippets side by side online and see which lines were added, removed or left unchanged. Free, and nothing is uploaded.
- Text Case Converter Online — camelCase, snake_case, Free
Convert text online to UPPER CASE, lower case, Title Case, Sentence case, camelCase, PascalCase, snake_case or kebab-case. Free, no login, in your browser.