Your customer has asked that all incidents be “scanned” for words that may revolve around product
defects and injures so that they can alert their risk management team of any possible product issues
or liability. The customer accepts that 100% accuracy is not available, and accepts that they will be
false positives and a margin for error. They have provided you he following words to be “scanned”:
1. Mouth
2. Jaw
3. Cheek
4. Jowl
5. Chin
6. Oral
7. Palate
The customer requires the following:
• Match whole words only
• All valid words must be preceded with a space.
• All valid words must be spelled correctly.
• All words must be directly followed by a meta character in this list:
• , {comma}
• . {period}
• ’ {single quote}
• ” {double quote}
• ; {semi colon}
• : {colon}
• {space}
• ! {exclamation point}
• ? {question mark}
• & {ampersand}
You decide to use a regular expression to search for these words in all incoming emails.
^mouth [ , | . | ’ | ” | ; | : | | ! | ? | & ] | \ jaw [| , | . | ‘ | “ | : | ! | &] | \ cheek [ , | ‘ | ; | : | | ! |
? | &] | \
jowl [ , | . | ‘ | ; | | !| ? | &] | \ chin$ [ , | . | ‘ | “ | ; | | ! | ? | & ] | \ oral [ , | . | ‘ | “ | : | | ? | & ] |
\ pallate [ , | . | ‘ | “ | : | | ! | ? | &] | \
Identify the three words that will be correctly matched to this regular expression.
A.
Mouth
B.
Jaw
C.
Cheek
D.
Jowl
E.
Chin
F.
Oral
G.
Palate
Explanation:
Incorrect:
Not A: mouth will not match ^mouth
Not E: chin will not match chin$
Not G: palate will not match pallate
The Correct answer is CDF
B won’t work because of [| in the beginning.