This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
C Library Regular Expression Problem
- To: gcc-bugs at gcc dot gnu dot org
- Subject: C Library Regular Expression Problem
- From: p dot klotz at icoserve dot com
- Date: Mon, 12 Mar 2001 09:57:04 +0100
- Reply-To: p dot klotz at icoserve dot com
Hi folks
I don't know if this is the correct place for my bug report but
nevertheless I hope you can help me.
My problem regards pattern matching from the GNU C library when using
Extended Regular Expressions.
Why does the pattern "[0]{1}" match the string "00" (the quotes are just
for better readability!)??
Since I am expecting exactly one single 0 the two 0 from the test string
should in my opinion be rejected.
A simple test program:
----
#include "unistd.h"
#include "regex.h"
int main(void)
{
int retval;
regex_t reginfo;
retval=regcomp(®info,"[0]{1}",REG_EXTENDED | REG_NOSUB); // gives 0
retval=regexec(®info,"00",0,0,0); // gives also 0 (why?)
return 0;
}
----