Flavors
PCRE2 (PHP >=7.3)
PCRE (PHP <7.3)
ECMAScript (JavaScript)
Python
Golang
Java 8
.Net (C#)
Rust
Explanation:
m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
g modifier: global. All matches (don't return after first match)
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
s modifier: single line. Dot matches newline characters
u modifier: unicode. Pattern strings are treated as UTF-16. Also causes escape sequences to match unicode characters
Matched Details:
Regular Expressions
- Matching letters and numbers only:
- [a-zA-Z0-9]+$
- Matching email addresses:
- \w+@[a-zA-Z_]+?.[a-zA-Z]{2,3}$
- Matching URLs:
- ((http|https)://)?([a-z0-9]+([-.]{1}[a-z0-9]+).[a-z]{2,5})(:[0-9]{1,5})?(/.)?$
- Matching phone numbers:
- \d{10}$
- Matching dates in the format MM/DD/YYYY:
- (0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])/([0-9]{4})$
- Matching hexadecimal colors:
- #?([a-f0-9]{6}|[a-f0-9]{3})$
- Matching IP addresses:
- ((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]?)$
- Matching any whitespace character:
- /\s/
- Matching non-word characters:
- \W
- Matching any digit:
- \d