From 50d8ed89b1e02917e83a33b3d62f465192dd500f Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 3 Dec 2020 16:38:26 -0800 Subject: sed: add 'x' flag to the 's' command. The GNU tar manual, when talking about the `tar --transform` option that I need to implement, describes the 'x' flag by saying "regexp is an extended regular expression (see section 'Extended regular expressions' in GNU sed)". Only it turns out that even the latest GNU sed doesn't actually have that flag. It's unique to `tar --transform`. That link is just telling you that the sed manual will explain extended regular expressions, not that GNU sed also supports the 'x' flag. So I don't know whether we want this in toybox sed after all. (It made sense that sed would have such a flag, but no sed that I know of actually does.) --- tests/sed.test | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/sed.test b/tests/sed.test index beb11d5c..c3928e58 100755 --- a/tests/sed.test +++ b/tests/sed.test @@ -185,6 +185,8 @@ testing '\n with empty capture' \ testing '\n too high' \ 'sed -E "s/(.*)/\2/p" 2>/dev/null || echo OK' "OK\n" "" "foo" +toyonly testing 's///x' 'sed "s/(hello )?(world)/\2/x"' "world" "" "hello world" + # Performance test X=x; Y=20; while [ $Y -gt 0 ]; do X=$X$X; Y=$(($Y-1)); done testing 'megabyte s/x/y/g (20 sec timeout)' \ -- cgit v1.2.3