Regular Expressions 101

Save & Share

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8

Function

  • Match
  • Substitution
  • List
  • Unit Tests
"
(?P<password>((?=\S*[A-Z])(?=\S*[a-z])(?=\S*\d)(?=\S*[\!\"\§\$\%\&\/\(\)\=\?\+\*\#\'\^\°\,\;\.\:\<\>\ä\ö\ü\Ä\Ö\Ü\ß\?\|\@\~\´\`\\])\S{8,}))
"
Named Capture Group password
(?P<password>((?=\S*[A-Z])(?=\S*[a-z])(?=\S*\d)(?=\S*[\!\"\§\$\%\&\/\(\)\=\?\+\*\#\'\^\°\,\;\.\:\<\>\ä\ö\ü\Ä\Ö\Ü\ß\?\|\@\~\´\`\\])\S{8,}))
2nd Capturing Group
((?=\S*[A-Z])(?=\S*[a-z])(?=\S*\d)(?=\S*[\!\"\§\$\%\&\/\(\)\=\?\+\*\#\'\^\°\,\;\.\:\<\>\ä\ö\ü\Ä\Ö\Ü\ß\?\|\@\~\´\`\\])\S{8,})
Positive Lookahead
(?=\S*[A-Z])
Assert that the Regex below matches
\S
matches any non-whitespace character (equivalent to [^\r\n\t\f\v ])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
Match a single character present in the list below
[A-Z]
A-Z matches a single character in the range between A (index 65) and Z (index 90) (case sensitive)
Positive Lookahead
(?=\S*[a-z])
Assert that the Regex below matches
\S
matches any non-whitespace character (equivalent to [^\r\n\t\f\v ])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
Match a single character present in the list below
[a-z]
a-z matches a single character in the range between a (index 97) and z (index 122) (case sensitive)
Positive Lookahead
(?=\S*\d)
Assert that the Regex below matches
\S
matches any non-whitespace character (equivalent to [^\r\n\t\f\v ])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\d matches a digit (equivalent to [0-9])
Positive Lookahead
(?=\S*[\!\"\§\$\%\&\/\(\)\=\?\+\*\#\'\^\°\,\;\.\:\<\>\ä\ö\ü\Ä\Ö\Ü\ß\?\|\@\~\´\`\\])
Assert that the Regex below matches
\S
matches any non-whitespace character (equivalent to [^\r\n\t\f\v ])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
Match a single character present in the list below
[\!\"\§\$\%\&\/\(\)\=\?\+\*\#\'\^\°\,\;\.\:\<\>\ä\ö\ü\Ä\Ö\Ü\ß\?\|\@\~\´\`\\]
\! matches the character ! with index 3310 (2116 or 418) literally (case sensitive)
\" matches the character " with index 3410 (2216 or 428) literally (case sensitive)
matches the character § with index 16710 (A716 or 2478) literally (case sensitive)
\$ matches the character $ with index 3610 (2416 or 448) literally (case sensitive)
\% matches the character % with index 3710 (2516 or 458) literally (case sensitive)
\& matches the character & with index 3810 (2616 or 468) literally (case sensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case sensitive)
\( matches the character ( with index 4010 (2816 or 508) literally (case sensitive)
\) matches the character ) with index 4110 (2916 or 518) literally (case sensitive)
\= matches the character = with index 6110 (3D16 or 758) literally (case sensitive)
\? matches the character ? with index 6310 (3F16 or 778) literally (case sensitive)
\+ matches the character + with index 4310 (2B16 or 538) literally (case sensitive)
\* matches the character * with index 4210 (2A16 or 528) literally (case sensitive)
\# matches the character # with index 3510 (2316 or 438) literally (case sensitive)
\' matches the character ' with index 3910 (2716 or 478) literally (case sensitive)
\^ matches the character ^ with index 9410 (5E16 or 1368) literally (case sensitive)
matches the character ° with index 17610 (B016 or 2608) literally (case sensitive)
\, matches the character , with index 4410 (2C16 or 548) literally (case sensitive)
\; matches the character ; with index 5910 (3B16 or 738) literally (case sensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
\: matches the character : with index 5810 (3A16 or 728) literally (case sensitive)
\< matches the character < with index 6010 (3C16 or 748) literally (case sensitive)
\> matches the character > with index 6210 (3E16 or 768) literally (case sensitive)
matches the character ä with index 22810 (E416 or 3448) literally (case sensitive)
matches the character ö with index 24610 (F616 or 3668) literally (case sensitive)
matches the character ü with index 25210 (FC16 or 3748) literally (case sensitive)
matches the character Ä with index 19610 (C416 or 3048) literally (case sensitive)
matches the character Ö with index 21410 (D616 or 3268) literally (case sensitive)
matches the character Ü with index 22010 (DC16 or 3348) literally (case sensitive)
matches the character ß with index 22310 (DF16 or 3378) literally (case sensitive)
\? matches the character ? with index 6310 (3F16 or 778) literally (case sensitive)
\| matches the character | with index 12410 (7C16 or 1748) literally (case sensitive)
\@ matches the character @ with index 6410 (4016 or 1008) literally (case sensitive)
\~ matches the character ~ with index 12610 (7E16 or 1768) literally (case sensitive)
matches the character ´ with index 18010 (B416 or 2648) literally (case sensitive)
\` matches the character ` with index 9610 (6016 or 1408) literally (case sensitive)
\\ matches the character \ with index 9210 (5C16 or 1348) literally (case sensitive)
\S
matches any non-whitespace character (equivalent to [^\r\n\t\f\v ])
{8,} matches the previous token between 8 and unlimited times, as many times as possible, giving back as needed (greedy)
Your regular expression does not match the subject string.

Regular Expression
No Match

r"
"

Test String