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: Abdulrahman Semrie <hsamireh <at> gmail.com>
To: 36251 <at> debbugs.gnu.org
Subject: bug#36251: Regex library doesn't recognize ']' in a character class
Date: Sun, 16 Jun 2019 20:16:29 +0300
[Message part 1 (text/plain, inline)]
I am using the pattern [\\[\\]a-zA-Z]+ to match a string with left or right bracket in it. However, the string-match function doesn’t match the ‘]’ character. To demonstrate with an example, try the following funciton:

(string-match "[\\[\\]a-zA-Z]+" "Text[ab]”)

The result for the above function should have been a match structure with Text[ab] matched. However, the string-match returns #f which is incorrect. To test if the pattern I am using was right, I tried on regex101.com and it works. Here (https://regex101.com/r/VAl6aI/1) is the link that demonstrates that it works.

Hence, the above leads me to believe there is a bug in the regex library that mishandles ] character in character-classes

—

Regards,

Abdulrahman Semrie

[Message part 2 (text/html, inline)]

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

Previous Next


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