The parentheses allows you to use regular expressions to perform string matches, or matches to actual words. Thus you may write a search that is looking for “virtual” or “main” with...
Accounting to gnu/sed manual,
Matches a sequence of zero or more instances of matches for the preceding regular expression, which must be an ordinary character, a special character preceded by \, a ., a grouped regexp (see below), or a bracket expression.
Regular expressions as a concept is not exclusive to Python at all. Python, however, does have some nuances when it come to working with regular expressions. This article is part of a series of articles on Python Regular Expressions.