To answer the specific question asked, there are two ways to use or concepts in Perl regular expressions. There is an alternation operator "|" or, as would be more applicable in your case, there is a one-or-none qualtifier "?". Both are discussed in
. You may also consider a read through of
to familiarize yourself with details in regular expressions. Of course for common regular expressions like the one you are looking for, there's usually an implementation you case borrow from
.