-----Original Message----- My guess is that I need a regex that will match on any character that is: not 0-9 or more than one "." or more than one "-" or if "-" is not the first character of the string
Any ideas? Is it possible to do without using additional modules? -------------------------- I haven't written a regex in a few months, but how about something like this: for ("2.314","-2.314","7","-7","2.31.4","7-7","UNKNOWN","7+E09") { $txtype=$_; $txtype=0 unless /^-?((\d+)|(\d*\.\d+)|(\d+\.\d*))$/; print "$_ => $txtype\n"; } ^ match beginning of string -? string MIGHT begin with a - (\d+) string of numbers with no . (\d*\.\d+) string of numbers with a . (digits only required AFTER .) (\d+\.\d*) string of numbers with a . (digits only required BEFORE .) (..|..|..) pick one of the three options for a match $ match end of the string Chris LEGAL NOTICE Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately. _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs