Regex Helper
Build, test, and understand regular expressions. Real-time pattern matching with explanations and syntax reference.
Match Results
0 matches/[a-z]+\.[a-z]{2,}/gi
Switch to the Test tab to try your pattern against sample text.
Character Classes
. | Any character except newline |
\d | Digit (0-9) |
\D | Non-digit |
\w | Word character (a-z, A-Z, 0-9, _) |
\W | Non-word character |
\s | Whitespace (space, tab, newline) |
\S | Non-whitespace |
[abc] | Any of a, b, or c |
[^abc] | Not a, b, or c |
[a-z] | Character range |
Anchors & Boundaries
^ | Start of string/line |
$ | End of string/line |
\b | Word boundary |
\B | Non-word boundary |
(?=...) | Positive lookahead |
(?!...) | Negative lookahead |
(?<=...) | Positive lookbehind |
(? | Negative lookbehind |
Quantifiers
* | 0 or more |
+ | 1 or more |
? | 0 or 1 (optional) |
{n} | Exactly n times |
{n,} | n or more times |
{n,m} | Between n and m times |
*? | Lazy (non-greedy) * |
+? | Lazy (non-greedy) + |
Groups & Capturing
(...) | Capturing group |
(?:...) | Non-capturing group |
(?<name>...) | Named capturing group |
\1, \2... | Backreference to group |
\k<name> | Named backreference |
| | Alternation (OR) |
Flags
g | Global (find all matches) |
i | Ignore case |
m | Multiline (^$ match lines) |
s | Dotall (. matches newlines) |
u | Unicode |
y | Sticky (match from lastIndex) |
Special Characters
\ | Escape character |
\n | Newline |
\r | Carriage return |
\t | Tab |
\v | Vertical tab |
\f | Form feed |
\0 | Null character |
\xhh | Hex character |
\uhhhh | Unicode character |
Email Addresses
/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g
Contact us at [email protected] for assistance with your inquiry.
Match: [email protected]UK Phone Numbers
/\+44\s\d{2}\s\d{4}\s\d{4}|0\d{4}\s\d{6}/g
Call our London office on +44 20 7946 0958 during business hours.
Match: +44 20 7946 0958Dates (DD/MM/YYYY)
/\b(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/\d{4}\b/g
The meeting is scheduled for 25/12/2024 in the conference room.
Match: 25/12/2024URLs
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g
Visit https://www.example.com/page for more information about our services.
Match: https://www.example.com/pagePostcodes (UK)
/[A-Z]{1,2}[0-9][A-Z0-9]?\s?[0-9][A-Z]{2}/g
Our headquarters are located at SW1A 1AA in central London.
Match: SW1A 1AACredit Card Numbers
/\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}/g
Your card ending in 4532 1234 5678 9012 has been approved.
Match: 4532 1234 5678 9012Hex Colour Codes
/#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/g
The brand colours are #FF5733 for primary and #333 for text.
Matches: #FF5733, #333IP Addresses
/\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/g
Server configuration: connect to 192.168.1.1 for admin panel.
Match: 192.168.1.1Words Starting with Capital
/\b[A-Z][a-zA-Z]*\b/g
The Quick Brown Fox Jumps Over the Lazy Dog in the Garden.
Matches: The, Quick, Brown, Fox, Jumps, Over, Lazy, Dog, GardenHTML Tags
/<([a-z][a-z0-9]*)\b[^>]*>(.*?)<\/\1>/gi
The content is wrapped in
Privacy
Runs entirely in your browserThis tool runs entirely in your browser. Your inputs are not sent to a server.