[PATCH] Fix regex \w and \W handling
Jakub Jelinek
jakub@redhat.com
Tue Jun 17 21:27:00 GMT 2003
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
More information about the Libc-hacker
mailing list