in reply to Re: Pattern matching
in thread Pattern matching

$a=~ /(tom)(dick|harry|john)/;

I really doubt that the OP wanted to match "tomdick", "tomharry" and "tomjohn". Shouldn't there be some provision for whitespace in the string too? ;) The other problem with that solution is, what if the string contains "john tom". I think the OP wants to match even if the two names are in different order. ...as long as tom and any of the other three names exist. That's why the two regexp approach works so elegantly.


Dave