DEV TOOLSDeveloper ToolsTechnology Calculator
🔍

Regex Tester — Test Regular Expressions

Test regex patterns with flags. See highlighted matches, count, and capture groups.

Concept Fundamentals
Global
g
Ignore case
i
Digit
\d
Word boundary
\b
Test RegexUse the calculator below to compute tech metrics

Why This Technology Metric Matters

Why: Regex is essential for text parsing, validation, and search. Testing before deploy prevents bugs.

How: Pattern compiles to RegExp. With g flag, exec() finds all matches. Captures in parentheses.

  • g = all matches
  • \d in JS strings
  • Avoid catastrophic backtracking

Sample Scenarios — Click to Load

Inputs

g=global, i=ignore case, m=multiline, s=dotall
regex_results.txt5 match(es)
# Highlighted matches:
Hello world! Test string 123.
# Match count: 5
# Matches with capture groups:
[1] "Hello" at index 0
[2] "world" at index 6
[3] "Test" at index 13
[4] "string" at index 18
[5] "123" at index 25
Share:

Match Summary

Input

Pattern\b\w+\b
Flagsg
Test length29 chars

Output

Match count5
Match 1"Hello" at 0
Match 2"world" at 6
Match 3"Test" at 13
Match 4"string" at 18
Match 5"123" at 25

⚠️For educational and informational purposes only. Verify with a qualified professional.

🔧 Tech Milestones

🔍

g flag finds all matches

— JS

🔢

\d = digit, \w = word char

— Regex

g = global (all matches); i = case-insensitive; m = multiline; s = dotall. Capture groups use parentheses. Escape special chars. In JS strings, backslashes must be doubled.

Frequently Asked Questions

What do the regex flags mean?

g = find all matches (global); i = case-insensitive; m = multiline (^ and $ match line boundaries); s = dotall (dot matches newlines).

How do capture groups work?

Parentheses create capture groups. The first group is match[1], second is match[2], etc. Use (?:...) for non-capturing groups.

Why is my regex not matching?

Check escaping: in JavaScript strings, backslashes must be doubled (e.g. \d for digit). Also verify flags and that the pattern matches your test string.

What is a word boundary?

\b matches between a word character (\w) and a non-word character. Useful for matching whole words only.

How do I match special characters?

Escape with backslash: \. for literal dot, \* for asterisk. In JS: "\." in the string.

What is catastrophic backtracking?

Nested quantifiers like (a+)+ can cause exponential time on certain inputs. Simplify or use atomic groups.

👈 START HERE
⬅️Jump in and explore the concept!
AI