If you know they will always be around -, then you might be able to do something like:
while( $line =~ /(\d\d?-\d\d?)|(T+)/g ) { push @snow, ($1 || $2); #T will be $2, not $1 } Also, I'm not sure why you had all of the [], they make a character class which is probably not what you want. ----- Original Message ----- From: Donald J Miller To: [EMAIL PROTECTED] Sent: Monday, January 14, 2002 12:34 PM Subject: A regex question Hello, I have a line of text like so: SNOW 12HR 00-00 00-00 1- 2 I've written a regex to parse these lines and grab the values in between the hyphens like so: while ($line =~ /([\d]{1,2})|([T+])/g) { push @snow, $1; } On occasion instead of a numerical snowfall amount "T" is used to indicate a trace. In the above line in question; I will get all the numbers however I also capture the "12" in "SNOW 12HR" which I don't want. I've modified the above regex to be like so; while ($line =~/([\d]{1,2})\W{1,2}|([T+])/g) {.... I eliminate the "12" in "12HR", however I also lose the last numerical forecast value (in the above line the final "2"). I am guessing my problem is likely with the newline at the end of the final digit however I've not been able to map a solution using regexes to this. Incidentally I've been able to solve the problem by using the first regex and eliminating the first "12" via a for loop and counting from $snow[1], not $snow[0]. Anyone have insights as to how the above regex could be made to work? Thanks, Don -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]