JustConvertAll-in-One Convert

Regex Tester

Test and debug regular expressions instantly online. Highlights matches, shows capture groups, and supports all JavaScript regex flags (g, i, m, s). Free regex tester — no signup required.

Pattern/g

Test String

Related Tools

Advertisement

Regular expressions are a formal language for pattern matching in strings, derived from Kleene's theoretical work on regular languages and implemented in virtually every programming language. JavaScript's RegExp engine supports the ECMAScript specification with Unicode mode, named capture groups, lookbehind assertions, and the g, i, m, s, u, and v flags introduced across ES2015–ES2024.

Developers use regular expressions constantly: validating email addresses and phone numbers in form inputs, extracting data from log files, performing find-and-replace transformations in text pipelines, parsing structured strings like log entries or CSV-like formats, and writing URL routing rules. Regex errors cause subtle bugs and security issues (ReDoS vulnerabilities).

This tool tests regular expressions using JavaScript's built-in RegExp constructor and String.matchAll(). It supports all four commonly needed flags (g for global, i for case-insensitive, m for multiline, s for dotAll), highlights all matches inline in the input text, and displays capture groups (both numbered and named) for each match in a structured table.

Common Use Cases

Building log parsing patterns

Apache and NGINX access logs, application logs from Log4j or Winston, and structured syslog entries all follow predictable formats. Writing a regex to extract IP addresses, HTTP status codes, request paths, and timestamps from log lines — before deploying it in a Logstash filter, a Python re.findall() call, or an AWS CloudWatch Insights query — requires iterative testing against real log samples.

Validating form input patterns

HTML5 input pattern attributes, JavaScript form validators, and backend validation libraries (Joi, Zod, Pydantic) use regular expressions to validate phone numbers, postal codes, credit card numbers, and custom ID formats. Testing the regex against valid and invalid samples before embedding it in a schema definition prevents both false positives and false rejections.

Writing VS Code search and replace patterns

VS Code's find-and-replace and the sed, perl, and awk command-line tools all accept regular expressions with capture group back-references. Developers writing refactoring patterns — renaming function signatures, transforming import paths, converting date formats in bulk — test the match pattern and replacement expression before running it across thousands of source files.

Crafting named capture groups for parsers

Modern regex engines including JavaScript support named capture groups (?<name>...), which produce structured objects from unstructured text. When building a parser for a domain-specific format — a custom log format, a DSL, or a structured filename convention — testing named groups against real input confirms that each named field extracts the correct substring.

Supported Flags

Quick Reference

.Any character
\dDigit (0–9)
\wWord char
\sWhitespace
^Start of string
$End of string
*0 or more
+1 or more
?0 or 1
(...)Capture group
[abc]Character class
[^abc]Negated class