- Save Regexctrl+s
- Go to library entry

- PCRE2 (PHP >=7.3)
- PCRE (PHP <7.3)
- ECMAScript (JavaScript)
- Python
- Golang
- Java 8

- Match
- Substitution
- List
- Unit Tests

Sponsor

Jamstack at Scale

/

(?:^([A-Y])?\s*(\d{0,4})\s?([a-d])?)|(?:^((?:\w+)|(?:\w+,)|(?:\w+, \w*))?\s*((?:&{1,2}|and|or|\|{2})\s+(?:.*)*)*)

/

gm

1st Alternative

(?:^([A-Y])?\s*(\d{0,4})\s?([a-d])?)

Non-capturing group

(?:^([A-Y])?\s*(\d{0,4})\s?([a-d])?)

^ asserts position at start of a line

1st Capturing Group

([A-Y])?

? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)

Match a single character present in the list below

[A-Y]

A-Y matches a single character in the range between A (index 65) and Y (index 89) (case sensitive)

\s

matches any whitespace character (equivalent to [\r\n\t\f\v ])* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)

2nd Capturing Group

(\d{0,4})

\d

matches a digit (equivalent to [0-9]){0,4} matches the previous token between 0 and 4 times, as many times as possible, giving back as needed (greedy)

\s

matches any whitespace character (equivalent to [\r\n\t\f\v ])? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)

3rd Capturing Group

([a-d])?

? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)

Match a single character present in the list below

[a-d]

a-d matches a single character in the range between a (index 97) and d (index 100) (case sensitive)

2nd Alternative

(?:^((?:\w+)|(?:\w+,)|(?:\w+, \w*))?\s*((?:&{1,2}|and|or|\|{2})\s+(?:.*)*)*)

Non-capturing group

(?:^((?:\w+)|(?:\w+,)|(?:\w+, \w*))?\s*((?:&{1,2}|and|or|\|{2})\s+(?:.*)*)*)

^ asserts position at start of a line

4th Capturing Group

((?:\w+)|(?:\w+,)|(?:\w+, \w*))?

1st Alternative

(?:\w+)

Non-capturing group

(?:\w+)

\w

matches any word character (equivalent to [a-zA-Z0-9_])+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)

2nd Alternative

(?:\w+,)

Non-capturing group

(?:\w+,)

\w

matches any word character (equivalent to [a-zA-Z0-9_])+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)

, matches the character , with index 44_{10} (2C_{16} or 54_{8}) literally (case sensitive)

3rd Alternative

(?:\w+, \w*)

Non-capturing group

(?:\w+, \w*)

\w

matches any word character (equivalent to [a-zA-Z0-9_])+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)

,

matches the characters , literally (case sensitive)\w

matches any word character (equivalent to [a-zA-Z0-9_])* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)

\s

matches any whitespace character (equivalent to [\r\n\t\f\v ])* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)

5th Capturing Group

((?:&{1,2}|and|or|\|{2})\s+(?:.*)*)*

* 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

Non-capturing group

(?:&{1,2}|and|or|\|{2})

1st Alternative

&{1,2}

&

matches the character & with index 382nd Alternative

and

and

matches the characters and literally (case sensitive)3rd Alternative

or

or

matches the characters or literally (case sensitive)4th Alternative

\|{2}

\|

matches the character | with index 124{2} matches the previous token exactly 2 times

\s

matches any whitespace character (equivalent to [\r\n\t\f\v ])Non-capturing group

(?:.*)*

.

matches any character (except for line terminators)Global pattern flags

g modifier: **g**lobal. All matches (don't return after first match)

m modifier: **m**ulti line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)

Your regular expression does not match the subject string.Try launching the debugger to find out why.

/

/

gm

Please wait while the app is loading...