🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50334

Regex problem

#50334
From: Per Olav Heggtveit
Date: Fri, 08 Oct 1993 15:38
31 lines
1376 bytes
I have two regular expressions defined as follows:

 Regex word1("\\(h?a\\(v\\|vn\\)?\\)+"); 
 Regex word2("\\(h?a\\(v\\|vn\\)?\\)");

The first one does _not_ recognize the word "havn", but the second one do.
When I change the definition of word1 to 

 Regex word3("\\(h?a\\(v\\|mn\\)?\\)+"); 
                          ^&^^
it recognize the word "hamn" correctly, but when I change to 

 Regex word4("\\(h?a\\(m\\|mn\\)?\\)+");
                      ^^^
"hamn" is not recognized.

Could anyone give me a reasonable explanation? 

(To match the regular expressions I used the string.matches() construction ) 




Per Olav Heggtveit
-- 
Norwegian Telecom Research
P.O. Box 83
N-2007 Kjeller
Tel: (47) 63 80 93 20
e-mail: per.heggtveit@tf.tele.no
 
Technical Details
Message-ID: <1993Oct8.153815.29539@nntp.nta.no>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!pipex!sunic!trane.uninett.no!nac.no!nntp.nta.no!hal.nta.no!poh

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,ff0ff718121b25c4,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-10-08 08:57:32 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!pipex!sunic!trane.uninett.no!nac.no!nntp.nta.no!hal.nta.no!poh
From: poh@hal.nta.no (Per Olav Heggtveit)
Subject: Regex problem
Message-ID: <1993Oct8.153815.29539@nntp.nta.no>
Sender: poh@hal.nta.no (Per Olav Heggtveit FST)
Nntp-Posting-Host: logos.nta.no
Organization: Norwegian Telecom Research
Date: Fri, 8 Oct 93 15:38:15 GMT
Lines: 31