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
/
^(?<streetname>\d*[\p{L}\d \'\/\\\\\-\.]+)[,\s]+(?<housenumber>\d+)\s*(?<ext>[\p{L} \d\-\/\'"\(\)]*)$
/
iu
^ asserts position at start of the string
Named Capture Group streetname
(?<streetname>\d*[\p{L}\d \'\/\\\\\-\.]+)
\d
matches a digit zero through nine in any script except ideographic scripts (equivalent to \p{Nd})
* 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
[\p{L}\d \'\/\\\\\-\.]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
\p{L} matches any kind of letter from any language
\d matches a digit zero through nine in any script except ideographic scripts (equivalent to \p{Nd})
matches the character with index 3210 (2016 or 408) literally (case insensitive)
\' matches the character ' with index 3910 (2716 or 478) literally (case insensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case insensitive)
\\ matches the character \ with index 9210 (5C16 or 1348) literally (case insensitive)
\\ matches the character \ with index 9210 (5C16 or 1348) literally (case insensitive)
\- matches the character - with index 4510 (2D16 or 558) literally (case insensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case insensitive)
Match a single character present in the list below
[,\s]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
, matches the character , with index 4410 (2C16 or 548) literally (case insensitive)
\s matches any kind of invisible character (equivalent to [\p{Z}\h\v])
Named Capture Group housenumber
(?<housenumber>\d+)
\d
matches a digit zero through nine in any script except ideographic scripts (equivalent to \p{Nd})
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
\s
matches any kind of invisible character (equivalent to [\p{Z}\h\v])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
Named Capture Group ext
(?<ext>[\p{L} \d\-\/\'"\(\)]*)
Match a single character present in the list below
[\p{L} \d\-\/\'"\(\)]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\p{L} matches any kind of letter from any language
matches the character with index 3210 (2016 or 408) literally (case insensitive)
\d matches a digit zero through nine in any script except ideographic scripts (equivalent to \p{Nd})
\- matches the character - with index 4510 (2D16 or 558) literally (case insensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case insensitive)
\' matches the character ' with index 3910 (2716 or 478) literally (case insensitive)
" matches the character " with index 3410 (2216 or 428) literally (case insensitive)
\( matches the character ( with index 4010 (2816 or 508) literally (case insensitive)
\) matches the character ) with index 4110 (2916 or 518) literally (case insensitive)
$ asserts position at the end of the string, or before the line terminator right at the end of the string (if any)
Global pattern flags
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
u modifier: unicode. Pattern strings are treated as UTF-16. Also causes escape sequences to match unicode characters
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
iu

Test String