go to previous page   go to home page   go to next page
String test = "Daisy";
   
String RE = "Daisy | Daisies";

Answer:

Does not match

The spaces inside the regular expression do not match characters of the string.


Beware of Spaces

Of course, leading or trailing spaces in either the string or the RE must match. (The " are not actually part of the regular expression nor are they part of the string.)

Regular ExpressionMatchesDoes Not MatchDoes Not Match
Daisy | Daisies "Daisy " "Daisy" "Daisies "
Daisy|Daisies " Daisy" " Daisies " "Daisy"
Daisy|Daisies "Daisy" " Daisy" "Daisy "

QUESTION 5:

Does the RE turtle match the string turtledove ?