1) Which of the following regular expressions will match only the string “42” from the string
“42 bottles of beer on the 3 walls”
a) “^[^ ]+”
b) “0-90-9″
c) “[0-9]+”
d) “42”
e) “..”
f) “dw”
2) In which of these scenarios is it possible to use regular expressions to write a program which always produces the correct answer? (choose as many as apply)
a) Matching (North American) telephone numbers formatted like (xxx) xxx-xxxx
b) (edited, after Ted’s comment) Finding all list literals in a Python program (like [1,2,3], [‘cow’, ‘red’, ‘dog’])
c) Matching telephone numbers with one of several possible formats (xxx) xxx-xxxx, xxxxxxxxxx, xxx xxx-xxxx
d) Writing a program to help cheat at crosswords (8-letter words that look like qu??t??n)
e) Finding a span tag with class “blah” in a HTML document and all its contents