On Nov 13, 2007 10:58 AM, Chas. Owens <[EMAIL PROTECTED]> wrote: snip > I believe you want /\d[a-z]{2}/i. snip
Oops, I didn't pay attention to my own warning about \d, I should have said /[0-9][a-z]{2}/i The whole regex should be $data =~ /^[a-z]{2,4} [0-9][a-z]{2}$/i; Other things to be aware of + your rule said space, but you used \s (which matches all whitespace characters like linefeed and tab) + you used the g option and a start-of-line character, you can't match the start-of-line more than once*, so the g option is pointless + you used the start-of-line character indicating that you were trying to make sure the string contains only the pattern you were looking for, but you did not include the end-of-line character which means that anything could exist after the match (this may have been on purpose, but it doesn't look that way) + it looks like you were trying to use capturing parenthesis, these slow down the regex engine and should not be used when you are just verifying that a string holds the expected value + it is not a good idea to use alternate regex delimiting characters (such as !) unless your regex contains /, you have to type more and it confuses people who are looking to see why you did it. * unless you use the m option, in which case that usage of the g option would be fine -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/