Hi.
I'm not a power user of RegExp but i think that the '*' is not applied
to the entire word 'netscape' but only to the last 'e'.
The forward slash is not a special character.
If you need to find the version then you must group the version/release
and get it with getParens(i):
"netscape(?)/([0-9]\.[0-9]{1-2})" -> if the release is at most 2 chars
and version only one.

Hope this helps a little.

Rui Duarte
Portugal


-----Original Message-----
From: Esbrook, Scott [mailto:[EMAIL PROTECTED]] 
Sent: segunda-feira, 13 de Janeiro de 2003 17:20
To: '[EMAIL PROTECTED]'
Subject: determine NS release/level using regexp



Hi. I'm somewhat of a regexp newbie, so apologies if this question is
painfully easy.

I created an RE object using code 

RE nsRegExp = new RE("(netscape*)/");

but when I do 

boolean matched = nsRegExp.match("mozilla/5.0 (windows; u; windows nt
5.0; en-us; rv:0.9.2) gecko/20010726 netscape6/6.1");

matched is coming back false. Is forward slash some kind of special
character? I don't see anything in the docs.

FYI--I'm trying to determine a user's browser version and release level
on server side. For Netscape 6 and up, I get the following useragent
strings:

useragent returned from NS 6.1 running on W2K:
mozilla/5.0 (windows; u; windows nt 5.0; en-us; rv:0.9.2) gecko/20010726
netscape6/6.1

useragent returned from NS 6.2 running on Win98:
mozilla/5.0 (windows; u; win98; en-us; rv:0.9.4) gecko/20011019
netscape6/6.2

useragent string returned from NS 7.01 running on W2K mozilla/5.0
(windows; u; windows nt 5.0; en-us; rv:1.0.2) gecko/20021120
netscape/7.01

Using jakarta-regexp-1.2. 

Thanks,

Scott Esbrook
Software Developer
Compuware Corporation



The contents of this e-mail are intended for the named addressee only.
It contains information that may be confidential. Unless you are the
named addressee or an authorized designee, you may not copy or use it,
or disclose it to anyone else. If you received it in error please notify
us immediately and then destroy it. 


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


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

Reply via email to