From f210cff601cf034c522b41cae6acd4f56060126d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 17 Aug 2009 01:35:04 +0200 Subject: sed: fix " echo /usr/lib | sed 's,\(^/\|\)[^/][^/]*,..,g' " bug function old new delta process_files 2102 2091 -11 Signed-off-by: Denys Vlasenko --- testsuite/sed.tests | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'testsuite/sed.tests') diff --git a/testsuite/sed.tests b/testsuite/sed.tests index a9d9ada31..696d980ef 100755 --- a/testsuite/sed.tests +++ b/testsuite/sed.tests @@ -241,4 +241,11 @@ testing "sed 2d;2,1p (gnu compat)" \ "third\n" "" \ "first\nsecond\nthird\nfourth\n" +# Regex means: "match / at BOL or nothing, then one or more not-slashes". +# The bug was that second slash in /usr/lib was treated as "at BOL" too. +testing "sed beginning (^) matches only once" \ + "sed 's,\(^/\|\)[^/][^/]*,>\0<,g'" \ + ">/usrlib<\n" "" \ + "/usr/lib\n" + exit $FAILCOUNT -- cgit v1.2.3