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
`
^Benchmark.*([^EncodingJson][^JsonIter][^(GoJay(Unsafe)?]|(Decoder|Reuse|String|Unmapped|GoJson(NoEscape)?))$
`
mg
^ asserts position at start of a line
Benchmark
matches the characters Benchmark literally (case sensitive)
.
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)
1st Capturing Group
([^EncodingJson][^JsonIter][^(GoJay(Unsafe)?]|(Decoder|Reuse|String|Unmapped|GoJson(NoEscape)?))
1st Alternative
[^EncodingJson][^JsonIter][^(GoJay(Unsafe)?]
Match a single character not present in the list below
[^EncodingJson]
EncodingJson
matches a single character in the list EncodigJs (case sensitive)
Match a single character not present in the list below
[^JsonIter]
JsonIter
matches a single character in the list JsonIter (case sensitive)
Match a single character not present in the list below
[^(GoJay(Unsafe)?]
(GoJay(Unsafe)?
matches a single character in the list (GoJayUnsfe)? (case sensitive)
2nd Alternative
(Decoder|Reuse|String|Unmapped|GoJson(NoEscape)?)
2nd Capturing Group
(Decoder|Reuse|String|Unmapped|GoJson(NoEscape)?)
1st Alternative
Decoder
Decoder
matches the characters Decoder literally (case sensitive)
2nd Alternative
Reuse
Reuse
matches the characters Reuse literally (case sensitive)
3rd Alternative
String
String
matches the characters String literally (case sensitive)
4th Alternative
Unmapped
Unmapped
matches the characters Unmapped literally (case sensitive)
5th Alternative
GoJson(NoEscape)?
GoJson
matches the characters GoJson literally (case sensitive)
3rd Capturing Group
(NoEscape)?
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
NoEscape
matches the characters NoEscape literally (case sensitive)
$ asserts position at the end of a line
Global pattern flags
m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
g modifier: global. All matches (don't return after first match)
Your regular expression does not match the subject string.

Regular Expression
No Match

`
`
mg

Test String