if ($info =~ /(hi|lo)\s+(\d{1,3}).F/i) { # do something with $1 and $2 }