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
"
\{\{MSP\|\d\d\d\|([\w é \' \. \-]+)\}\}
"
g
\{ matches the character { with index 12310 (7B16 or 1738) literally (case sensitive)
\{ matches the character { with index 12310 (7B16 or 1738) literally (case sensitive)
MSP
matches the characters MSP literally (case sensitive)
\| matches the character | with index 12410 (7C16 or 1748) literally (case sensitive)
\d matches a digit (equivalent to [0-9])
\d matches a digit (equivalent to [0-9])
\d matches a digit (equivalent to [0-9])
\| matches the character | with index 12410 (7C16 or 1748) literally (case sensitive)
1st Capturing Group
([\w é \' \. \-]+)
Match a single character present in the list below
[\w é \' \. \-]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
\w matches any word character (equivalent to [a-zA-Z0-9_])
é
matches a single character in the list é (case sensitive)
\' matches the character ' with index 3910 (2716 or 478) literally (case sensitive)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
\- matches the character - with index 4510 (2D16 or 558) literally (case sensitive)
\} matches the character } with index 12510 (7D16 or 1758) literally (case sensitive)
\} matches the character } with index 12510 (7D16 or 1758) literally (case sensitive)
Global pattern flags
g modifier: global. All matches (don't return after first match)
Your regular expression does not match the subject string.

Regular Expression
No Match

r"
"
g

Test String