Alternations, denoted by the |
character, match a single item out of several possible items separated by the vertical bar. When used inside a character class, it will match characters; when used inside a group, it will match entire expressions (i.e., everything to the left or everything to the right of the vertical bar). We must use parentheses to limit the use of alternations.
For example:
(Bob|Kevin|Stuart)
will match eitherBob
orKevin
orStuart
.([a-f]|[A-F])
will match any of the following characters:a
,b
,c
,d
,e
,f
,A
,B
,C
,D
,E
, orF
.
Task
Given a test string, , write a RegEx that matches under the following conditions:
- must start with
Mr.
,Mrs.
,Ms.
,Dr.
orEr.
. - The rest of the string must contain only one or more English alphabetic letters (upper and lowercase).
Note: This is a RegEx-only challenge. You are not required to write code; you simply need to fill in the blank.