I'm not sure what the character class with the hyphen in there is for. Do you want to capture the temperatures, too? If so, here's what I'd try:
if ($info =~ /(hi|lo)\s+(\d{1,3}).F/i) {
# do something with $1 and $2
}
You were on the right track... but the square brackets puzzle me.
Update: jlp suggests that temperatures may be negative, in which case it makes lots of sense. Here's the revision to allow that:
if ($info =~ /(hi|lo)\s+(-?\d{1,3}).F/i) {
# do something with $1 and $2
}
The ? means the hyphen may or may not be present. If it is, it will be grouped with the digits and stored in $2. |