Thread View: gnu.g++.lib.bug
1 messages
1 total messages
Started by T.Day
Sun, 26 Nov 1989 16:47
Regex problem : matches empty strings
Author: T.Day
Date: Sun, 26 Nov 1989 16:47
Date: Sun, 26 Nov 1989 16:47
24 lines
767 bytes
767 bytes
From: Tim Day <T.Day@uk.ac.ucl.cs>
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 <stream.h>
#include <String.h>
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads