Newsgroups: comp.os.msdos.djgpp X-Comment-To: All From: Oleg Ossovitskii X-FTN-Sender: "Oleg O. Ossovitskii" Date: Sat, 25 Sep 99 15:59:53 +0300 Subject: Regexp Message-ID: <938279461@p20.f44.n478.z2.FidoNet.ftn> Organization: Without C we'd have BASI, PASAL & OBOL ;-) X-FTN-AREA: HURRICANE.COMP.OS.MSDOS.DJGPP X-FTN-MSGID: 2:478/44 DOT 20 AT FidoNet DOT org 37ed0225 X-FTN-CHRS: IBMPC 2 X-FTN-RealName: Oleg O. Ossovitskii ICQ UIN: 28860835 X-FTN-NickName: Stryker X-FTN-TID: FastEcho 1.46 28860835 X-FTN-Tearline: GoldEd/386 3.0.1-asa9 SR1 X-FTN-Origin: Without C we'd have BASI, PASAL & OBOL ;-) (2:478/44.20) X-FTN-SEEN-BY: 478/44 X-FTN-PATH: 478/44 X-FTN-PATH: 478/44 Lines: 49 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello, All! I have to write regexp to match all of that strings: `HR-16', `HR-32', `ZR-16', `ZR-32'. I try this: ================== Begin of rege.cc ================= #include #include #include <_String.h> int main(void) { Regex rx ("[HZ]R-(16|32)"); // <-- there trouble ;-( String s; char str[128]; cout << "Input string: "; cin.getline(str, 127); s = str; if( s.contains(rx) ) cout << "Matched!" << endl; else cout << "Don't match ;-(" << endl; cout << s; return 0; } /* * Local variables: * compile-command: "gpp -O2 -o rege -s rege.cc -lgpp" * End: */ =================== End of rege.cc ================== If I write regexp "[ZH]R-(16)" that don't match string ZR-16, but if I write "[ZH]R-\\(16\\)" that matched ZR-16 & HR-16, but I need ZR-16 & ZR-32! And if I write "[ZH]R-\\(16|32\\)" that don't match nor ZR-16 nor ZR-32 and nor HR-16 etc. I have gcc 2.95. Please help me, or sent me via e-mail documentation on regexps from djgpp with _examples_. Thank You for Your answer. WBR, Oleg Ossovitskii E-mail: avatar AT netcity DOT ru ... Solve millenuim bug! - y2k.com [ FA EB FE C3 ]