From 9c9319dd8a54db45c35d960e18cde22fe7a32a1a Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Sat, 26 Sep 2020 23:56:02 +0200 Subject: [PATCH] added find and replace script --- tests/find-replace | 95 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100755 tests/find-replace diff --git a/tests/find-replace b/tests/find-replace new file mode 100755 index 0000000..99e3a4b --- /dev/null +++ b/tests/find-replace @@ -0,0 +1,95 @@ +#!/usr/bin/env curly +>main +gto +:find +=i +=term +=text +:loop +$text +$i +$i +$term +len +add +slc +=part +$i +$i +inc +=i +$i +$text +len +$term +len +sub +>not-found +ggt +$part +$term +>loop +gne +ret +:not-found +neg +ret +:replace-all +=replacement +=quest +=target +\ +=result +0 +=from +:replace-loop +$target +$quest +$from +>find +fun +=pos +$pos +0 +>replace-done +glt +$result +$target +$from +$pos +slc +$replacement +cat +cat +=result +$pos +$quest +len +add +=from +>replace-loop +gto +:replace-done +$result +$target +$from +$target +len +slc +cat +ret +:main +\Bananen hangen in warme landen aan de bananenboom. +\an +\@|\| +>replace-all +fun +out +=_ +$target +\en +\un +>replace-all +fun +out +end