If you really want to do it with a regex you can:
use strict; use warnings; use noname1; my $str = 'ASBSDEC 34 GADVVEEVEETTE 56 IOEOREAK GKJEOG EFEAF 1090 DAFF +EE 376'; my $result; my $biggest = 0; 1 while ($str =~ /(\w+)\s+(\d+)(?{if($2 > $biggest) {$result=[$1, $2]; + $biggest=$2}})/gx); print "$result->[0] $result->[1]";
Prints:
EFEAF 1090
In reply to Re: Help with regex, how to get the largest integer in a string?
by GrandFather
in thread Help with regex, how to get the largest integer in a string?
by coltman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |