On 5/13/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: snip
or /a (?:black|grey|white|) cat/;
snip
It is sad to say, but I had never thought of using a pipe at the end to cause a submatch to be optional. That is a nifty solution. Too much thinking inside the box for me, I guess. I would have said /a (?:black|grey|white)? cat/ Although, it might (and I stress might) be more correct to say /a (?:(?:black|grey|white) )?cat/ since two spaces is odd (even though it is even). Or, if they are just tokens separated by whitespace: /a\s+(?:black|grey|white)\s*cat or the more readable (to me at least) /a \s+ (?: black | grey | white ) \s* cat/x -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/