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
"
(.*)?_G_(.*)_TC_(.*)_TOTAL_Sum_(.*)
"
1st Capturing Group
(.*)?
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
.
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)
_G_
matches the characters _G_ literally (case sensitive)
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)
_TC_
matches the characters _TC_ literally (case sensitive)
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)
_TOTAL_Sum_
matches the characters _TOTAL_Sum_ literally (case sensitive)
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)
Your regular expression does not match the subject string.

Regular Expression
No Match

r"
"

Test String

Substitution

Processing...