This is the mail archive of the glibc-bugs-regex@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug regex/1171] New: \] does not work in brackets


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]