You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-user@jakarta.apache.org by "Esbrook, Scott" <Sc...@compuware.com> on 2003/01/13 18:19:57 UTC

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: determine NS release/level using regexp

Posted by Schamil Wackenhut <sw...@wacke.org>.
* Esbrook, Scott meinte:

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

this matches:
'n' followed by 'e' fb 't' fb 's' ... fb 'p' fb 'e' fb 'null or more "e"'
fb '/'
 
> boolean matched = nsRegExp.match("mozilla/5.0 (windows; u; windows nt 5.0;
> en-us; rv:0.9.2) gecko/20010726 netscape6/6.1");

return false, cause 'e' is followed by '6' not 'null or more "e"'

.sw
-- 
bash$ :(){ :|:&};:

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>