Regex to English
Paste a regular expression to get a plain-English explanation of every component. 100% client-side.
How to Use the Regex Explainer
- Type or paste your regex in the input field — without surrounding slashes (e.g.,
^hello\s+world$not/^hello\s+world$/). - Set flags if needed — g (global), i (case-insensitive), m (multiline), s (dotAll).
- Choose a view mode — Detailed for full component-by-component breakdown, Summary for a one-paragraph description, Tree View for a nested structure.
- Copy or download the explanation for documentation or sharing.
Regex Syntax Quick Reference
Regular expressions use a compact syntax that can look intimidating at first. This explainer breaks down each token into plain language. Here is a reference of the most common constructs.
Anchors
Anchors match positions, not characters. ^ matches the start of the string (or start of each line in multiline mode). $ matches the end of the string (or end of each line). \b matches a word boundary — the position between a word character and a non-word character. \B matches any position that is not a word boundary.
Character Classes
A character class [abc] matches any single character listed inside the brackets. Ranges like [a-z] match any lowercase letter. A negated class [^abc] matches any character NOT in the list. Shorthand classes provide compact notation: \d matches digits (equivalent to [0-9]), \w matches word characters ([a-zA-Z0-9_]), \s matches whitespace (spaces, tabs, newlines). Their uppercase versions (\D, \W, \S) match the inverse.
Quantifiers
Quantifiers specify how many times the preceding element must match. * means zero or more, + means one or more, ? means zero or one (optional). Exact counts use curly braces: {3} means exactly 3 times, {2,5} means between 2 and 5 times, {2,} means 2 or more times. All of these are greedy by default — adding ? after (*?, +?, ??) makes them lazy, matching as few characters as possible.
Groups and Alternation
Parentheses (abc) create a capture group that records the matched text for later use. (?:abc) creates a non-capturing group, useful for grouping without capturing. Named groups (?<name>abc) let you reference the capture by name. Alternation cat|dog matches either "cat" or "dog". Lookaheads (?=...) and lookbehinds (?<=...) match positions based on context without consuming characters.
Common Regex Patterns Explained
Email validation: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ — starts with one or more alphanumeric/special characters, followed by @, a domain, a dot, and a TLD of 2+ letters. URL matching: https?://[^\s]+ — http or https, followed by ://, followed by non-whitespace characters. IPv4: (\d{1,3}\.){3}\d{1,3} — three groups of 1-3 digits followed by dots, then a final group of digits.
For hands-on testing of your regex patterns, use our Regex Tester. To escape special characters in strings for use in regex, try the String Escape tool.