This is the mail archive of the
glibc-bugs-regex@sourceware.org
mailing list for the glibc project.
[Bug regex/1171] New: \] does not work in brackets
- From: "zlomek at gcc dot gnu dot org" <sourceware-bugzilla at sources dot redhat dot com>
- To: glibc-bugs-regex at sources dot redhat dot com
- Date: 4 Aug 2005 13:08:19 -0000
- Subject: [Bug regex/1171] New: \] does not work in brackets
- Reply-to: sourceware-bugzilla at sources dot redhat dot com
The following regular expressions do not work as expected, i.e they do not match
any char except '[' or ']':
[^\[\]]
[^\]\[]
It does not work for normal nor extened regular expressions.
[^\]] does not work either for matching anything but ']'.
When [^]] is specified, it does match any char except ']'.
Testcase:
#include <sys/types.h>
#include <regex.h>
#include <stdlib.h>
#include <stdio.h>
int
main (int argc, char **argv)
{
int err;
regex_t r;
err = regcomp (&r, "[^\\]\\[]", 0);
if (err != 0) {
printf("regcomp: %d\n", err);
}
err = regexec (&r, "a", 0, 0, 0);
if (err != 0) {
printf("regexec: %d\n", err);
}
return 0;
}
--
Summary: \] does not work in brackets
Product: glibc
Version: 2.3.3
Status: NEW
Severity: normal
Priority: P2
Component: regex
AssignedTo: gotom at debian dot or dot jp
ReportedBy: zlomek at gcc dot gnu dot org
CC: glibc-bugs-regex at sources dot redhat dot com,glibc-
bugs at sources dot redhat dot com
http://sources.redhat.com/bugzilla/show_bug.cgi?id=1171
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.