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 (10)
/
S3[AB_]_GN_1_
/
gm
S3
matches the characters S3 literally (case sensitive)
Match a single character present in the list below
[AB_]
AB_
matches a single character in the list AB_ (case sensitive)
_GN_1_
matches the characters _GN_1_ literally (case sensitive)
Global pattern flags
g modifier: global. All matches (don't return after first match)
m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)

Regular Expression

/
/
gm

Unit Tests

EGP: EOPHAX
EGP: GLCHAX
EGP: GSVHAX
EGP: GSVMAX
EGP: EOPHAX
IERS: EOP_AX
IERS: LSC_AX
NOAA: SAC_AX
FOS: MANHAX
FOS: MASSAX