Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!uunet!mcsun!ukc!kl-cs!nott-cs!ucl-cs!T.Day From: T.Day@ucl-cs.UUCP Newsgroups: gnu.g++.lib.bug Subject: Regex problem : matches empty strings Message-ID: <472@ucl-cs.UUCP> Date: 26 Nov 89 16:47:58 GMT Sender: T.Day@ucl-cs.UUCP Lines: 24 From: Tim Day On a Sun-3 (OS4) with ``gcc version 1.36.1 (based on GCC 1.36)'' comparing any empty string with a Regex always seems to evaluate to TRUE. e.g.... #include #include main() { if (String("").matches(Regex("xxx"))) cerr << "OOPS!\n"; else cerr << "OK\n"; if (String("yyy").matches(Regex("xxx"))) cerr << "OOPS\n"; else cerr << "OK\n"; exit(0); } Outputs: OOPS! OK