|
|
Message-ID: <20200418111309.GD23945@port70.net>
Date: Sat, 18 Apr 2020 13:13:09 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: "liheng (P)" <liheng40@...wei.com>
Cc: Florian Weimer <fw@...eb.enyo.de>, Rich Felker <dalias@...c.org>,
"musl@...ts.openwall.com" <musl@...ts.openwall.com>,
"Xiangrui (Euler)" <rui.xiang@...wei.com>,
Lizefan <lizefan@...wei.com>
Subject: Re: regex Back reference matching result not same as glibc
and tre.
* liheng (P) <liheng40@...wei.com> [2020-04-18 11:07:20 +0000]:
> static const char pat[] = "\\(.?\\).?\\1";
> string: "aba";
? is not special in bre
it should be \{0,1\} (i think we support \? as an extension,
but unescaped ? only matches literal ?). try one of
static const char pat[] = "\\(.\\{0,1\\}\\).\\{0,1\\}\\1";
static const char pat[] = "\\(.\\?\\).\\?\\1";
>
> I tested this pattern by my test case just now.
>
> musl:
> # ./test
> regexec failed
> test regex failed
>
> glibc:
> # ./test
> Invalid back reference
> test regex failed
>
> tre:
> # ./test
> Invalid back reference
> test regex failed
>
> -----Original Message-----
> From: Florian Weimer [mailto:fw@...eb.enyo.de]
> Sent: Saturday, April 18, 2020 6:29 PM
> To: liheng (P) <liheng40@...wei.com>
> Cc: Rich Felker <dalias@...c.org>; musl@...ts.openwall.com; Xiangrui (Euler) <rui.xiang@...wei.com>; Lizefan <lizefan@...wei.com>
> Subject: Re: [musl] regex Back reference matching result not same as glibc and tre.
>
> * liheng:
>
> > static const char pat[] = "(.?).?\\1";
>
> > This commit reminds me that if i want to use back reference i should
> > not to tag REG_EXTENDED, but this test case matching still failed.
>
>
> Did you change the expression to this for the basic regular expression test?
>
> static const char pat[] = "\\(.?\\).?\\1";
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.