\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
(?<![:.\w])(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}(?![:.\w])
^[a-fA-F0-9]{2}(:[a-fA-F0-9]{2}){5}$
Special characters are limited
^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$ %^&*-]).{8,}$
matches URLS starting with http
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)
^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
Pattern | Description |
[abc] | A single character of: a, b or c |
[^abc] | A character except: a, b or c |
[a-z] | A character in the range: a-z |
[^a-z] | A character not in the range: a-z |
[a-zA-Z] | A character in the range: a-z or A-Z |
. | Any single chracter |
a |b | Alternate - match either a or b |
\s | Any whitespace character |
\S | Any non-whitespace character |
\d | Any digit |
\D | Any non-digit |
\w | Any word character |
\W | Any non-word character |
(?:...) | Match everything enclosed |
(...) | Capture everything enclosed |
a? | Zero or one of a |
a* | Zero or more of a |
a+ | One or more of a |
a{3} | Exactly 3 of a |
a{3,} | 3 or mor of a |
a{3,6} | Between 3 and 6 of a |
^ | Start of string |
$ | End of string |
\b | A word boundary |
\B | Non-word boundary |
Pattern | Description |
\n | Newline |
\r | Carriage return |
\t | Tab |
\0 | Null character |
Pattern | Description |
\G | Start of match |
^ | Start of string |
$ | End of string |
\A | Start of string |
\Z | End of string |
\z | Absolut end of string |
\b | A word boundary |
\B | Non-word boundary |
Pattern | Description |
. | Any single chracter |
a |b | Alternate - match either a or b |
\s | Any whitespace character |
\S | Any non-whitespace character |
\d | Any digit |
\D | Any non-digit |
\w | Any word character |
\W | Any non-word character |
\X | Any Unicode sequence, linebreks included |
\C | MAtch one data unit |
\R | Unicode newlines |
\N | Match anything but a newline |
\v | Vertical whitespace character |
\V | Negative of \v |
\h | Horizontal whitespace character |
\H | Negative of \h |
\K | Reset match |
\# | Match subpattern number # |
\pX | Unicode property X |
\p{...} | Unicode preoperty or script category |
\PX | Negation of \pX |
\P{...} | Negation of p{...} |
\Q...\E | Quote; treat as literals |
\k{name} | Match subpattern name |
\k<name> | Match subpattern name |
\k'name' | Match subpattern name |
\gn | Match nth subpattern |
\g{n} | Match nth subpattern |
\g{-n} | Match text the nth relative previouse subpattern matched |
\g<n> | Recurse nth capture group |
\g<+n> | Recurse nth relative upcoming subpattern |
\g'n' | Recurse nth capture group |
\g'+n' | Recurse nth relative upcoming subpattern |
\g{letter} | Match previously-named capture group letter |
\g<letter> | Match previously-named capture group letter |
\g'letter' | Match previously-named capture group letter |
\xYY | Hex character YY |
\x{YYYY} | Hex character YYYY |
\ddd | Octal character ddd |
\cY | Control character Y |
[\b] | Backspace character |
\ | Makes any character literal |
Pattern | Description |
a? | Zero or one of a |
a* | Zero or more of a |
a+ | One or more of a |
a{3} | Exactly 3 of a |
a{3,} | 3 or mor of a |
a{3,6} | Between 3 and 6 of a |
a* | Greedy quantifier |
a*? | Layz quantifier |
a*+ | Possessiv quantifier |
Pattern | Description |
(?:...) | Match everything enclosed |
(...) | Capture everything enclosed |
(?>...) | Atomic group (non-capturing) |
(? |...) | Duplicate/reset subpattern group number |
(?#...) | Comment group |
(?'name'...) | Named Capturing Group |
(?<name>...) | Named Capturing Group |
(?P<name>...) | Named Capturing Group |
(?imsxUJnxx) | Inline modifiers |
(?imsxUJnxx:...) | Localized inline modifiers |
(?(1)yes |no) | Conditional statement |
(?(R)yes |no) | Conditional statement |
(?(R#)yes |no) | Recursive conditional statement |
(?(R&name)yes |no) | Conditinal statement |
(?(?=...)yes |no) | Lookahead conditional |
(?(?<=...)yes |no) | Lookbehind conditional |
(?R) | Recurse entrie pattern |
(?1) | Recurse first subpattern |
(?+1) | Recurse first relative subpattern |
(?&name) | Recurse subpattern name |
(?P=name) | Match subpattern name |
(?P>name) | Recurse subpattern called name |
(?(DEFINE)...) | Pre-define patterns before using them |
(?=...) | Positive lookahead |
(?!...) | Negative lookahead |
(?<=...) | Positive lookbehind |
(?<!...) | Negative lookbehind |
(*ACCEPT) | Control verb |
(*FAIL) | Control verb |
(*MARK:NAME) | Control verb |
(*PRUNE) | Control verb |
(*SKIP) | Control verb |
(*THEN) | Control verb |
(*UTF) | Pattern modifier |
(*UTF8) | Pattern modifier |
(*UTF16) | Pattern modifier |
(*UTF32) | Pattern modifier |
(*UCP) | Pattern modifier |
(*CR) | Line break modifier |
(*LF) | Line break modifier |
(*CRLF) | Line break modifier |
(*ANYCRLF) | Line break modifier |
(*ANY) | Line break modifier |
\R | Line break modifier |
(*BSR_ANYCRLY) | Line break modifier |
(*BSR_UNICODE) | Line break modifier |
(*LIMIT_MATCH=x) | Regex engine modifier |
(*LIMIT_RECURSION=d) | Regex engine modifier |
(*NO_AUTO_POSSESS) | Regex engine modifier |
(*NO_START_OPT) | Regex engine modifier |
Pattern | Description |
[abc] | A single character of: a, b or c |
[^abc] | A character except: a, b or c |
[a-z] | A character in the range: a-z |
[^a-z] | A character not in the range: a-z |
[a-zA-Z] | A character in the range: a-z or A-Z |
[[:alnum:]] | Letter and diget |
[[:ascii:]] | ASCII codes 0-127 |
[[:blank:]] | Space or tab only |
[[:cntrl:]] | Control character |
[[:digit:]] | Decimal digit |
[[:graph:]] | Visible character (not space) |
[[:lower:]] | Lowercase letter |
[[:print:]] | Visible character |
[[:punct:]] | Visible punctuation character |
[[:space:]] | Whitespace |
[[:upper:]] | Uppercase letter |
[[:word:]] | Word character |
[[:xdigit:]] | Hexadecimal digit |
[[:<:]] | Start of word |
[[:>:]] | End of word |
Pattern | Description |
g | Global |
m | Multiline |
i | Case insensitive |
x | Ignore whitespace /verbose |
s | Single line |
u | Unicode |
X | eXtra |
U | Ungreedy |
A | Anchor |
J | Duplicate group name |
Pattern | Description |
$1 | Contents in capture group 1 |
${foo} | Contens in capture group foo |
\x20 | Hexadecimal replacement values |
\x{06fa} | Hexadecimal replacement values |
\t | Tab |
\r | Carriage return |
\f | From-feed |
\U | Uppercase Transformation |
\L | Lowercase Transformation |
\E | Terminate any Transformation |