go to previous page   go to home page   go to next page

Answer:

M..


The useful .*

Regular Expression
(Delimit with quotes)
String
(Delimit with quotes)

The subexpression .* is often useful to match characters that surround the part of a string you are interested in. The following expression

.*blue.*

matches any string with the substring blue in it. The expression matches:

Once in a blue moon.

Greedy Again! For this RE to work, both .* parts must not match too much. Potentially, the first one might match the entire string, but this would cause the complete RE to fail. The same is true with the second .* part. Luckily, both parts match as much as they can but let blue match the substring that it needs to match.


QUESTION 3:

People often confuse "affect" and "effect". You might want to inspect a file to find such errors.

Write a RE to match any string that contains effect, affect, Effect, or Affect.