From 134abcb5b9ba854fec25051cd3c9f88e760913c5 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 2 Oct 2003 22:41:11 +0000 Subject: Update. 2003-09-26 Paolo Bonzini * posix/regcomp.c (parse_sub_exp): Pass RE_CARET_ANCHORS_HERE for the first token in a subexpression as well. 2003-10-02 Jakub Jelinek * posix/regcomp.c (peek_token): Add 2003-09-20 changes for anchor handling again. (parse_reg_exp): Likewise. * posix/regex.h (RE_CARET_ANCHORS_HERE): Define. * posix/bug-regex11.c (tests): Add new tests. * posix/bug-regex12.c (tests): Add new test. --- posix/bug-regex11.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'posix/bug-regex11.c') diff --git a/posix/bug-regex11.c b/posix/bug-regex11.c index 681888c..40fd7c2 100644 --- a/posix/bug-regex11.c +++ b/posix/bug-regex11.c @@ -1,5 +1,5 @@ /* Regular expression tests. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2002. @@ -41,7 +41,17 @@ struct { { 0, 21 }, { 8, 9 }, { 9, 10 } } }, { "^\\(a*\\)\\1\\{9\\}\\(a\\{0,9\\}\\)\\([0-9]*;.*[^a]\\2\\([0-9]\\)\\)", "a1;;0a1aa2aaa3aaaa4aaaaa5aaaaaa6aaaaaaa7aaaaaaaa8aaaaaaaaa9aa2aa1a0", 0, - 5, { { 0, 67 }, { 0, 0 }, { 0, 1 }, { 1, 67 }, { 66, 67 } } } + 5, { { 0, 67 }, { 0, 0 }, { 0, 1 }, { 1, 67 }, { 66, 67 } } }, + /* Test for BRE expression anchoring. POSIX says just that this may match; + in glibc regex it always matched, so avoid changing it. */ + { "\\(^\\|foo\\)bar", "bar", 0, 2, { { 0, 3 }, { -1, -1 } } }, + { "\\(foo\\|^\\)bar", "bar", 0, 2, { { 0, 3 }, { -1, -1 } } }, + /* In ERE this must be treated as an anchor. */ + { "(^|foo)bar", "bar", REG_EXTENDED, 2, { { 0, 3 }, { -1, -1 } } }, + { "(foo|^)bar", "bar", REG_EXTENDED, 2, { { 0, 3 }, { -1, -1 } } }, + /* Here ^ cannot be treated as an anchor according to POSIX. */ + { "(^|foo)bar", "(^|foo)bar", 0, 2, { { 0, 10 }, { -1, -1 } } }, + { "(foo|^)bar", "(foo|^)bar", 0, 2, { { 0, 10 }, { -1, -1 } } }, }; int -- cgit v1.1