What's wrong with \w and underscore?

"Normand Rivard" <[email protected]> Mon, 04 Nov 2002 18:21:35 -0500
Newsgroups gmane.comp.jakarta.regexp.user
Organization Imperial Tobacco
Message-ID <[email protected]>
Hi,

while using regexp 1.2 to parse a property file, I have a problem with
the _ character (underscore). I have the following code:

try {
	RE pattern = new RE("(\\w+)=(.*)");
	pattern.match("asdf_qwer=kajflkjaflksafsajflkf");
	System.out.println(pattern.getParen(1));
}
catch (RESyntaxException e) {
}

I would expect getParen(1) to match with asdf_qwer, but instead the
output of this is : 
qwer

The regexp documentation specifies that \w matches alphanumeric
including _, but somehow it doesn't work. For fun, I tried the following
similar code in Perl:

  print $1 if "asdf_qwer=kajflkjaflksafsajflk" =~ /(\w+)=(.*)/;

The output of this is:
asdf_qwer
as expected. What am I missing here? It is so big, I can't believe this
is a bug. I tried to look in the archive of this mailing list, but
couln't find anything relevant.

Thanks
nrivard.vcf (text/x-vcard, 208 B)
begin:vcard 
n:Rivard;Normand
tel;work:(514)932-6161 ext 2713
x-mozilla-html:FALSE
org:Imperial Tobacco
adr:;;;;;;
version:2.1
email;internet:[email protected]
title:Senior Architect
fn:Normand Rivard
end:vcard
smime.p7s (application/x-pkcs7-signature, 1.7 KB) - not displayed