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
/
^.+? ?, ?(A[LKSZRAP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADL N]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD] |T[NX]|UT|V[AIT]|W[AIVY])$
/
i
^ asserts position at start of the string
.
matches any character (except for line terminators)
+? matches the previous token between one and unlimited times, as few times as possible, expanding as needed (lazy)
matches the character with index 3210 (2016 or 408) literally (case insensitive)
, matches the character , with index 4410 (2C16 or 548) literally (case insensitive)
matches the character with index 3210 (2016 or 408) literally (case insensitive)
1st Capturing Group
(A[LKSZRAP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADL N]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD] |T[NX]|UT|V[AIT]|W[AIVY])
1st Alternative
A[LKSZRAP]
A matches the character A with index 6510 (4116 or 1018) literally (case insensitive)
Match a single character present in the list below
[LKSZRAP]
LKSZRAP
matches a single character in the list LKSZRAP (case insensitive)
2nd Alternative
C[AOT]
C matches the character C with index 6710 (4316 or 1038) literally (case insensitive)
Match a single character present in the list below
[AOT]
AOT
matches a single character in the list AOT (case insensitive)
3rd Alternative
D[EC]
D matches the character D with index 6810 (4416 or 1048) literally (case insensitive)
Match a single character present in the list below
[EC]
EC
matches a single character in the list EC (case insensitive)
4th Alternative
F[LM]
F matches the character F with index 7010 (4616 or 1068) literally (case insensitive)
Match a single character present in the list below
[LM]
LM
matches a single character in the list LM (case insensitive)
5th Alternative
G[AU]
G matches the character G with index 7110 (4716 or 1078) literally (case insensitive)
Match a single character present in the list below
[AU]
AU
matches a single character in the list AU (case insensitive)
6th Alternative
HI
HI
matches the characters HI literally (case insensitive)
7th Alternative
I[ADL N]
I matches the character I with index 7310 (4916 or 1118) literally (case insensitive)
Match a single character present in the list below
[ADL N]
ADL N
matches a single character in the list ADL N (case insensitive)
8th Alternative
K[SY]
K matches the character K with index 7510 (4B16 or 1138) literally (case insensitive)
Match a single character present in the list below
[SY]
SY
matches a single character in the list SY (case insensitive)
9th Alternative
LA
10th Alternative
M[ADEHINOPST]
11th Alternative
N[CDEHJMVY]
12th Alternative
O[HKR]
13th Alternative
P[ARW]
14th Alternative
RI
15th Alternative
S[CD]
16th Alternative
T[NX]
17th Alternative
UT
18th Alternative
V[AIT]
19th Alternative
W[AIVY]
$ asserts position at the end of the string, or before the line terminator right at the end of the string (if any)
Global pattern flags
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
i

Test String

Substitution

Processing...