This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Fix \w in regex


This patch restores the previous behaviour of \w and related patterns in
regex matching: it should match not only letters and numbers, but also
'_'.

2001-07-18  Andreas Schwab  <schwab@suse.de>

	* posix/regex.c (WORDCHAR_P) [WCHAR]: Also return true for the
	underscore character.

--- posix/regex.c.~1.103.~	Mon Jul 16 10:43:43 2001
+++ posix/regex.c	Tue Jul 17 23:54:17 2001
@@ -5347,7 +5347,9 @@
 /* Use internationalized API instead of SYNTAX.  */
 # define WORDCHAR_P(d)							\
   (iswalnum ((wint_t)((d) == end1 ? *string2				\
-           : (d) == string2 - 1 ? *(end1 - 1) : *(d))) != 0)
+           : (d) == string2 - 1 ? *(end1 - 1) : *(d))) != 0		\
+   || ((d) == end1 ? *string2						\
+       : (d) == string2 - 1 ? *(end1 - 1) : *(d)) == L'_')
 #else /* BYTE */
 # define WORDCHAR_P(d)							\
   (SYNTAX ((d) == end1 ? *string2					\

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5


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