From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 32336 invoked from network); 18 Apr 2020 11:13:23 -0000 Received-SPF: pass (mother.openwall.net: domain of lists.openwall.com designates 195.42.179.200 as permitted sender) receiver=inbox.vuxu.org; client-ip=195.42.179.200 envelope-from= Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with UTF8ESMTPZ; 18 Apr 2020 11:13:23 -0000 Received: (qmail 1160 invoked by uid 550); 18 Apr 2020 11:13:22 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 1139 invoked from network); 18 Apr 2020 11:13:21 -0000 Date: Sat, 18 Apr 2020 13:13:09 +0200 From: Szabolcs Nagy To: "liheng (P)" Cc: Florian Weimer , Rich Felker , "musl@lists.openwall.com" , "Xiangrui (Euler)" , Lizefan Message-ID: <20200418111309.GD23945@port70.net> Mail-Followup-To: "liheng (P)" , Florian Weimer , Rich Felker , "musl@lists.openwall.com" , "Xiangrui (Euler)" , Lizefan References: <6D612B6AC5DCDA4580AF97B1068118AD2DC49A@DGGEML501-MBX.china.huawei.com> <874kth84v9.fsf@mid.deneb.enyo.de> <6D612B6AC5DCDA4580AF97B1068118AD2DC524@DGGEML501-MBX.china.huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6D612B6AC5DCDA4580AF97B1068118AD2DC524@DGGEML501-MBX.china.huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [musl] regex Back reference matching result not same as glibc and tre. * liheng (P) [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@deneb.enyo.de] > Sent: Saturday, April 18, 2020 6:29 PM > To: liheng (P) > Cc: Rich Felker ; musl@lists.openwall.com; Xiangrui (Euler) ; Lizefan > 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";