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
"
\bfull name \| \b(.*)\bdate of birth \| \b(.*)\bplace of birth \| \b(.*)\bdate of death \| \b(.*)\bplace of death \| \b(.*)
"
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
full name
matches the characters full name literally (case sensitive)
\| matches the character | with index 12410 (7C16 or 1748) literally (case sensitive)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
1st Capturing Group
(.*)
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
date of birth
matches the characters date of birth literally (case sensitive)
\| matches the character | with index 12410 (7C16 or 1748) literally (case sensitive)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
2nd Capturing Group
(.*)
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
place of birth
matches the characters place of birth literally (case sensitive)
\| matches the character | with index 12410 (7C16 or 1748) literally (case sensitive)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
3rd Capturing Group
(.*)
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
date of death
matches the characters date of death literally (case sensitive)
\| matches the character | with index 12410 (7C16 or 1748) literally (case sensitive)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
4th Capturing Group
(.*)
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
place of death
matches the characters place of death literally (case sensitive)
\| matches the character | with index 12410 (7C16 or 1748) literally (case sensitive)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
5th Capturing Group
(.*)
.
matches any character (except for line terminators)
* matches the previous token between zero 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

Substitution

Processing...