How to Use the Online Regex Tester
Enter your regular expression pattern in the Pattern field at the top. The tool validates your regex syntax in real time — if the pattern is invalid, you will see an error message explaining what went wrong. You can type a pattern from scratch or choose from the preset patterns dropdown to start with a common regex like email validation, URL matching, or IP address detection.
Set the regex flags using the flag toggles next to the pattern field. The most commonly used flags are: g (global — find all matches, not just the first), i (case-insensitive — match uppercase and lowercase interchangeably), and m (multiline — make ^ and $ match the start and end of each line, not just the entire string). You can enable multiple flags simultaneously.
Paste or type your test string in the Test String field below. Matching portions of the text are highlighted instantly as you type, so you can see exactly what your pattern captures. If the global flag (g) is enabled, all matches in the string are highlighted. Without the global flag, only the first match is shown.
Review the matches panel below the test string to see each match listed with its index position and matched text. If your regex contains capture groups (parenthesized subpatterns), each group's content is shown separately. Named capture groups display with their group name. This is useful for understanding complex patterns that extract specific parts of a string, such as dates, phone numbers, or structured identifiers.
Why Use UtilDaily's Regex Tester?
- Instant visual feedback — matches highlight in real time as you type the pattern or test string
- Capture group visualization — see exactly what each parenthesized group captures, including named groups
- Preset pattern library — start from common regex patterns for emails, URLs, IP addresses, dates, and more
- Full flag support — toggle global, case-insensitive, multiline, dotAll, and Unicode flags with one click
- 100% browser-based — your test strings and patterns never leave your device or touch any server
- No account, no signup, no rate limits — test as many patterns as you need for free
- Works offline after page load — no internet connection required for regex testing
Frequently Asked Questions
What is a regular expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. Regex patterns are used in programming to match, search, extract, and replace text. They are supported in virtually every programming language, text editor, and command-line tool. For example, the pattern \d{3}-\d{4} matches a string like '555-1234' — three digits, a hyphen, and four digits. Regular expressions range from simple literal matches to complex patterns with quantifiers, character classes, lookaheads, and backreferences.
What do the regex flags g, i, m mean?
The g (global) flag finds all matches in the string rather than stopping at the first match. The i (case-insensitive) flag makes the pattern match both uppercase and lowercase characters — so /abc/i matches 'ABC', 'abc', and 'Abc'. The m (multiline) flag changes the behavior of ^ and $ anchors: without m, they match the start and end of the entire string; with m, they match the start and end of each line within the string. Other useful flags include s (dotAll — makes . match newline characters) and u (Unicode — enables full Unicode matching).
What is a capture group?
A capture group is a portion of a regex pattern enclosed in parentheses (). When the pattern matches, the text matched by each capture group is captured separately and can be accessed by index. For example, the pattern (\d{4})-(\d{2})-(\d{2}) matching '2024-01-15' captures three groups: '2024', '01', and '15'. Named capture groups use the syntax (?<name>...) — for example, (?<year>\d{4}) captures the year with the label 'year'. Capture groups are essential for extracting structured data from strings.
Why is my regex not matching anything?
Common reasons a regex fails to match: (1) Missing the global flag — without g, the pattern stops after the first match and may appear to miss later occurrences. (2) Forgetting to escape special characters — characters like . * + ? ( ) [ ] { } \ ^ $ | have special meaning in regex and must be escaped with a backslash (e.g., \. to match a literal period). (3) Anchors too restrictive — ^ and $ anchor to line boundaries; if your test string has the match in the middle, anchored patterns won't find it. (4) Multiline issues — if your test string spans multiple lines, enable the m flag to make ^ and $ work per-line. Try removing parts of your pattern to isolate which section is preventing the match.
What is the difference between greedy and lazy matching?
Greedy quantifiers (*, +, ?) match as much text as possible while still allowing the overall pattern to succeed. Lazy quantifiers (*?, +?, ??) match as little text as possible. For example, given the string '<b>hello</b><b>world</b>', the greedy pattern <b>.*</b> matches the entire string from the first <b> to the last </b>, while the lazy pattern <b>.*?</b> matches only '<b>hello</b>' — stopping at the earliest possible </b>. Use lazy matching when you want the shortest match between delimiters.
By UtilDaily · Updated \u2014 free, privacy-first browser tools. No sign-up, no data collection.