|
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) {
} 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,
|
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
