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]
Other format: [Raw text]

[PATCH] Fix regex \w and \W handling


Hi!

At least according to info sed, info grep and previous regex implementation,
\w should be [_[:alnum:]], not [_[:alpha:]] as current glibc regex uses.
Couldn't find a word about \w/\W in POSIX 2003 though.

Also, info sed mentions \s and \S to match any whitespace (or
non-whitespace), but apparently current sed does not handle it (as it uses
glibc regex). This might clash with \sCLASS and \SCLASS in emacs regexs
(support for them was in old glibc regex.c #ifdef emacs).

2003-06-17  Jakub Jelinek  <jakub@redhat.com>

	* posix/regcomp.c (build_word_op): Use alnum instead of alpha class.

--- libc/posix/regcomp.c.jj	2003-06-16 14:26:20.000000000 -0400
+++ libc/posix/regcomp.c	2003-06-17 16:39:27.000000000 -0400
@@ -3341,7 +3341,7 @@ build_word_op (dfa, trans, not, err)
 #ifdef RE_ENABLE_I18N
 			 mbcset, &alloc,
 #endif /* RE_ENABLE_I18N */
-			 (const unsigned char *) "alpha", 0);
+			 (const unsigned char *) "alnum", 0);
 
   if (BE (ret != REG_NOERROR, 0))
     {

	Jakub


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