public inbox for glibc-bugs-regex@sourceware.org
help / color / mirror / Atom feed
* [Bug regex/1171] New: \] does not work in brackets
@ 2005-08-04 13:08 zlomek at gcc dot gnu dot org
  2005-08-04 14:43 ` [Bug regex/1171] " schwab at suse dot de
  0 siblings, 1 reply; 2+ messages in thread
From: zlomek at gcc dot gnu dot org @ 2005-08-04 13:08 UTC (permalink / raw)
  To: glibc-bugs-regex

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug regex/1171] \] does not work in brackets
  2005-08-04 13:08 [Bug regex/1171] New: \] does not work in brackets zlomek at gcc dot gnu dot org
@ 2005-08-04 14:43 ` schwab at suse dot de
  0 siblings, 0 replies; 2+ messages in thread
From: schwab at suse dot de @ 2005-08-04 14:43 UTC (permalink / raw)
  To: glibc-bugs-regex


------- Additional Comments From schwab at suse dot de  2005-08-04 14:43 -------
\ is not special inside bracket expression. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-04 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-04 13:08 [Bug regex/1171] New: \] does not work in brackets zlomek at gcc dot gnu dot org
2005-08-04 14:43 ` [Bug regex/1171] " schwab at suse dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).