My QA Projects

QA Projects I was involded.

View on GitHub

Pattern Matching - Grouping and Delimiting

Anchors

Start Anchor Examples

Pattern String  
^[Bb]erkeley UC Berkeley no match
^[Bb]erkeley berkeley match
^[Bb]erkeley Berkeley, Ca match
^[Bb]erkeley UC Berkley no match (misspelling)

Anchors Examples

Pattern String  
^[Bb]erkeley$ UC Berkeley no match
^[Bb]erkeley$ berkeley match
^[Bb]erkeley$ Berkeley, Ca no match
^[Bb]erkeley$ UC Berkley no match (misspelling)

Grouping — Alternative Patterns

Or Example

Pattern String  
software|hardware software no match
software|hardware hardware no match
software|hardware dinnerware hardware match
software|hardware firmware no match

Grouping Patterns

Grouping

(...)
# starts and ends a group of regex patterns
(?P<name>...)
# starts and ends a named group name of regex patterns

Grouping Example

Pattern String  
(soft|hard)ware software match
(soft|hard)ware hardware match
(soft|hard)ware dinnerware hardware match
(soft|hard)ware firmware no match