[EMAIL PROTECTED] wrote:
> 
> In a message dated 3/29/03 7:16:57 AM Eastern Standard Time,
> [EMAIL PROTECTED] writes:
> 
> > > This returns 4. I need the Opera 7.0 to be in $browser.
> >
> > my $string = 'Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT
> > 5.1) Opera 7.0 [en]';
> >
> > my ($browser) = $string =~ /(\w+\s*[\d.]+)(?!.*\d)/i;
> >
> > print $browser;
> >
> > this works if the version numbers ar the last digits on the line
> 
>  But it doesn't solve my problem. This returns MSIE 5.5 not Opera 7.0 on the
> example above. Still looking for an answer.


my $string = 'Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT
5.1) Opera 7.0 [en]'; 

my ($browser1) = $string =~ /(\w+\s*[\d.]+)(?!.*\d)/; 
my ($browser2) = $string =~ /(\w+\s*[\d.]+)\D*$/;

print "$browser1\n$browser2";

Both of these work for me
output:
Opera 7.0
Opera 7.0

/Stefan

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to