Index: lib/libc/regex/regex.3 =================================================================== --- lib/libc/regex/regex.3 (revision 286580) +++ lib/libc/regex/regex.3 (working copy) @@ -723,5 +723,3 @@ .Pp The implementation of word-boundary matching is a bit of a kludge, and bugs may lurk in combinations of word-boundary matching and anchoring. -.Pp -Word-boundary matching does not work properly in multibyte locales. Index: lib/libc/regex/regexec.c =================================================================== --- lib/libc/regex/regexec.c (revision 286580) +++ lib/libc/regex/regexec.c (working copy) @@ -116,9 +116,9 @@ #define FWD(dst, src, n) ((dst) |= ((unsigned long)(src)&(here)) << (n)) #define BACK(dst, src, n) ((dst) |= ((unsigned long)(src)&(here)) >> (n)) #define ISSETBACK(v, n) (((v) & ((unsigned long)here >> (n))) != 0) -/* no multibyte support */ -#define XMBRTOWC xmbrtowc_dummy -#define ZAPSTATE(mbs) ((void)(mbs)) +/* multibyte support */ +#define XMBRTOWC xmbrtowc +#define ZAPSTATE(mbs) memset((mbs), 0, sizeof(*(mbs))) /* function names */ #define SNAMES /* engine.c looks after details */ @@ -170,9 +170,9 @@ #define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here]) #define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here]) #define ISSETBACK(v, n) ((v)[here - (n)]) -/* no multibyte support */ -#define XMBRTOWC xmbrtowc_dummy -#define ZAPSTATE(mbs) ((void)(mbs)) +/* multibyte support */ +#define XMBRTOWC xmbrtowc +#define ZAPSTATE(mbs) memset((mbs), 0, sizeof(*(mbs))) /* function names */ #define LNAMES /* flag */