Subpatterns and alternative patterns Flashcards

0
Q

(?:…)

A

Non-capturing group - group subpattern, but don’t capture the match. Example: (?:foo)bar matches foobar and doesn’t capture anything

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

(…)

A

Capturing group - group subpattern and capture the match. Example: (foo)bar matches foobar and captures foo

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

…|…

A

Alternation operator - matches one of the alternative subppatterns. Example: foo|bar|baz matches either foo, bar or baz

How well did you know this?
1
Not at all
2
3
4
5
Perfectly