Regex Validator
Check if a regular expression pattern is valid and inspect its structure.
//
Enter a regex pattern above to validate its syntax and inspect its structure
FAQ
- How is this different from a regex tester?
- A regex tester checks whether a pattern matches a given text input. This tool validates the regex pattern itself — it checks that the pattern is syntactically valid JavaScript regex, counts groups, identifies named captures, and surfaces structural information about the pattern without requiring test input.
- What flags does JavaScript regex support?
- JavaScript supports these flags: g (global — find all matches), i (case-insensitive), m (multiline — ^ and $ match line boundaries), s (dotAll — dot matches newlines), u (unicode mode), v (unicode sets, ES2024), and d (generate indices for substrings). Flags can be combined in any order.
- What are named capture groups?
- Named capture groups use the syntax (?<name>...) and let you reference matched substrings by name rather than index. For example, /(?<year>\d{4})-(?<month>\d{2})/ has two named groups: year and month. They are accessible via match.groups.year and match.groups.month.
Enter a JavaScript regular expression pattern and optional flags to validate the regex itself — not text against it. Shows whether the pattern compiles without errors, parsed flags, group count, named capture groups, and a description of common pattern constructs found. Useful for debugging regex syntax before using it in code.