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
1
Q
(…)
A
Capturing group - group subpattern and capture the match. Example: (foo)bar matches foobar and captures foo
2
Q
…|…
A
Alternation operator - matches one of the alternative subppatterns. Example: foo|bar|baz matches either foo, bar or baz