From 16bf40bd649ba065a7a0a6008c8434335ffae55a Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 28 Aug 2021 14:26:32 -0700 Subject: Added tests/tutorial --- tests/25-replace-capture.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 tests/25-replace-capture.sh (limited to 'tests/25-replace-capture.sh') diff --git a/tests/25-replace-capture.sh b/tests/25-replace-capture.sh new file mode 100644 index 0000000..f401605 --- /dev/null +++ b/tests/25-replace-capture.sh @@ -0,0 +1,4 @@ +# Captures with @ can be referenced in a replacement by @1, @2, etc. +# Example: bp -p '"=" _ @+`0-9 => "= -@1"' replaces "x = 5" with "x = -5" +# Note: @0 refers to the entire match, e.g. bp -p '"foo" => "xx@0xx"' replaces "foo" with "xxfooxx" +bp -p '@`a,e,i,o,u => "{@1}" / .' -- cgit v1.2.3