Package: manpages Version: 3.25-1 Severity: normal Hello,
According to regex(7) manpage, a backslash followed by any other character than ^.[$()|*+?{\ matches that character taken as an ordinary character, as if the backslash had not been present. However:
* According to POSIX[0], the interpretation of an ordinary character preceded by a backslash is undefined.
* Worse still, the described behavior differs from what is actually implemented in the GNU libc:
$ gcc -Wall testre.c -o testre && ./testre \S matches foobar
[0] http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04_02 -- Jakub Wilk
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
const char *pattern = "\\S";
const char *text = "foobar";
int main(int argc, char **argv)
{
int rc;
regex_t re;
rc = regcomp(&re, pattern, REG_EXTENDED | REG_NOSUB);
if (rc != 0)
abort();
if (regexec(&re, text, 0, NULL, 0) == 0)
printf("%s matches %s\n", pattern, text);
else
printf("%s doesn't match %s\n", pattern, text);
regfree(&re);
return 0;
}
signature.asc
Description: Digital signature

