Next | Regular Expression Mastery | 24 |
/dog|fish/
With dogfish it matches dog, not fish, even though fish is longer
Because dog is further to the left
Similarly:
/Larry|Larry Wall/
Good Morning Larry Wall
It gets Larry, not Larry Wall
Even though Larry Wall is longer
Because Perl tries the alternatives in order
We'll see later that this is useful
Next | Copyright © 2002 M. J. Dominus |