guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regex parenthesis handling bug


From: Gary Houston
Subject: Re: Regex parenthesis handling bug
Date: 21 Oct 2001 17:58:23 -0000

> From: Neil Jerram <address@hidden>
> Date: 21 Oct 2001 11:18:50 +0100
> 
> According to the libc manual, all libc regex settings default to the
> Emacs behaviour, so unquoted parens should match literal parens in the
> match string, while quoted parens indicate grouping.
> 
> In Guile, it doesn't work like this...
> 
> guile> (string-match "\\(x\\)" "x")
> $3 = #f
> guile> (string-match "x" "x")
> $4 = #("x" (0 . 1))
> guile> (string-match "(x)" "x")
> $5 = #("x" (0 . 1) (0 . 1))
> guile> (string-match "(x)" "(x)")
> $7 = #("(x)" (1 . 2) (1 . 2))
> guile> (string-match "\\(x\\)" "(x)")
> $8 = #("(x)" (0 . 3))
> guile>
> 
> I don't think this is a Guile bug, because Guile's regex functions
> fall straight through to libc.  Does anyone know if this is a known
> libc bug, and whether there is a nice workaround?

The libguile functions use POSIX interfaces with REG_EXTENDED defined,
which makes unquoted parens into match delimiters.  Adding the
REG_BASIC flag should reverse it.  I can't find anything about Emacs
behaviour in the glibc (2.2.2) manual, it just says:

   The GNU C library supports two interfaces for matching regular
expressions.  One is the standard POSIX.2 interface, and the other is
what the GNU system has had for many years.

and doesn't seem to describe the "many years" version further.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]