GNU bug report logs - #36251
Regex library doesn't recognize ']' in a character class

Previous Next

Package: guile;

Reported by: Abdulrahman Semrie <hsamireh <at> gmail.com>

Date: Sun, 16 Jun 2019 18:32:01 UTC

Severity: normal

Tags: notabug

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: <tomas <at> tuxteam.de>
To: Mark H Weaver <mhw <at> netris.org>
Cc: Abdulrahman Semrie <hsamireh <at> gmail.com>, 36251 <at> debbugs.gnu.org
Subject: bug#36251: Regex library doesn't recognize ']' in a character class
Date: Tue, 18 Jun 2019 13:20:07 +0200
[Message part 1 (text/plain, inline)]
On Tue, Jun 18, 2019 at 07:08:06AM -0400, Mark H Weaver wrote:
> Hi,
> 
> Abdulrahman Semrie <hsamireh <at> gmail.com> writes:
> 
> > I am using the pattern [\\[\\]a-zA-Z]+ to match a string with left or
> > right bracket in it [...]

> It turns out that there are several flavors of regular expressions in
> common use, with different features and syntax.  The link you provided
> is using PCRE (PHP) regular expressions (see the "flavor" pane on the
> left), and there are three other supported flavors on that web site.
> 
> Guile's (ice-9 regex) module provides a simpler flavor of regexps known
> as "POSIX extended regular expressions" [...]

D'oh! I forgot about Perl compatible regexps. In those, you /can/ escape
things with a backslash whithin [...]. This would have explained Abdulrhaman's
confusion better.

Thanks, Mark
-- t
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 6 years and 16 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.