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
/
(?:H\s*=\s*{{H-Sätze)((\|\d{3})*)(}})(?:\n|)
/
Non-capturing group
(?:H\s*=\s*{{H-Sätze)
H matches the character H with index 7210 (4816 or 1108) literally (case sensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v \u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
= matches the character = with index 6110 (3D16 or 758) literally (case sensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v \u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff])
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
{{H-Sätze
matches the characters {{H-Sätze literally (case sensitive)
1st Capturing Group
((\|\d{3})*)
2nd Capturing Group
(\|\d{3})*
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated group to capture all iterations or use a non-capturing group instead if you're not interested in the data
\| matches the character | with index 12410 (7C16 or 1748) literally (case sensitive)
\d
matches a digit (equivalent to [0-9])
{3} matches the previous token exactly 3 times
3rd Capturing Group
(}})
}}
matches the characters }} literally (case sensitive)
Non-capturing group
(?:\n|)
1st Alternative
\n
\n matches a line-feed (newline) character (ASCII 10)
2nd Alternative null, matches any position
Your regular expression does not match the subject string.

Regular Expression
No Match

/
/

Test String