Pedro Antonio Reche wrote at Wed, 11 Jun 2003 13:38:18 -0500: > I would like to match a string if it has only cero or more of a defined > set of characters. > For example: > if "GACT" are the characters, then > > GACTNGACT ## This string should not be matched because it has the extra > character N > GACCCCCCC ## This could be matched; > > Any help to solve this problem will be greatly appreciated.
Just another (from my point of view direct) view is $string =~ /^[GACT]*$/; The anchor stands for the beginning of the string, [GACT]* stands for zero or more of the defined characters $ stands for the end of the string. If you want to know more about regexps, read perldoc perlre Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]