Regex Tester
Developer tool for building and validating regex patterns with comprehensive analysis.
Regular Expression
Flags
g
Length
0
Named groups
None
Flags & Options
Samples
History
No entries yetTest String
Replacement Preview
Provide a replacement string to preview transformed output.
Highlighted Matches
Provide a test string to view highlighted matches.
Match Details
Run the regex to see per-match breakdowns here.
Match Summary
Live metrics update with each edit.
Matches
0
Groups
0
Execution
0 ms
Input size
0 chars
Words
0
Lines
0
Named groups
None
About Regex Tester Tool
Experiment with JavaScript regular expressions using real-time feedback, syntax highlighting, match statistics, and replacement previews. Everything runs locally in your browser for speed and privacy.
Key Capabilities
- Instant validation: See whether your pattern parses and how long execution takes.
- Live highlighting: Visualize matches directly inside the test text.
- Advanced flags: Toggle
g,i,m,u,s, andyoptions. - Replacement preview: Enter replacement strings (including captured groups) to view transformed output.
- Detailed analysis: Inspect indices, context, capture groups, and named groups for every match.
- History & samples: Quickly load curated examples or revisit saved patterns.
Usage Workflow
- Enter a regular expression and optional replacement string.
- Add or paste test data into the Test String panel (uploading a file works too).
- Modify flags to control case sensitivity, multiline anchors, Unicode handling, DotAll behaviour, or sticky matching.
- Click Run Regex (or simply type—evaluation happens automatically).
- Review highlighted matches, summary statistics, and per-match details.
- Export the results as JSON or copy outputs to the clipboard.
Interactive Examples
Open the Samples dropdown to preload curated scenarios. Each one highlights a different regex concept—run them as provided, tweak the pattern, then re-run to see how the outputs change.
- Email Addresses:
([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+.[A-Za-z]{2,}): Captures user and domain parts. Try togglingifor strict case checks or add+to require a top-level domain. - ISO Dates:
(?<year>\d{4})-(?<month>0[1-9]|1[0-2])-(?<day>0[1-9]|[12]\d|3[01]): Demonstrates named groups and numeric ranges. Experiment with invalid months to observe failed matches. - URLs:
(https?):\/\/([\w.-]+)(\/[\w./?%&=-]*)?: Breaks out protocol, host, and optional path. Togglegto find every link andito allow mixed-case schemes. - Hex Colors:
#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})\b: Matches shorthand and long-form CSS colors. Use replacements likecolor:$&;to see the live substitution preview. - Markdown Links:
[(?<label>[^\]]+)]((?<url>[^\s)]+)(?:\s"(?<title>[^"]+)")?): Extracts label, URL, and optional title. Inspect the match details pane to see named captures in action.
Build on the samples
- Duplicate a sample into history, then iterate on stricter or more permissive variants.
- Combine snippets—for instance, nest the date pattern inside the URL sample to catch timestamped resources.
- Switch to your own data by uploading logs, configuration files, or markdown content for real-world practice.
Flag Reference
g(global) – continue searching after the first match.i(ignore case) – case-insensitive comparisons.m(multiline) – treat^and$as line anchors.u(unicode) – enable Unicode mode and property escapes like \p{Letter}.s(dotAll) – allow.to match newline characters.y(sticky) – match from the current index without skipping ahead.
Replacement Tips
- Use
$1,$2, … for numbered capture groups. - Use
$&for the entire match,$`for the prefix, and$'for the suffix. - Named groups can be referenced as
$<groupName>when the Unicode flag is enabled.
Best Practices
- Start with provided samples to verify behaviour before adapting to your data.
- Keep auto-save enabled to preserve your work between sessions.
- Watch the execution time metric when crafting complex expressions.
- Use the history panel to compare different pattern strategies.
All processing occurs client-side; no data ever leaves your browser.
