]> git.plutz.net Git - confetti/commitdiff
Merge commit '6fdb619bc3d03f6d4877bbf840483e15f8bb6953'
authorPaul Hänsch <paul@plutz.net>
Tue, 14 May 2024 10:31:04 +0000 (12:31 +0200)
committerPaul Hänsch <paul@plutz.net>
Tue, 14 May 2024 10:31:04 +0000 (12:31 +0200)
1  2 
cgilite/storage.sh

diff --combined cgilite/storage.sh
index 17ea0d051eaf27233f8b5cd96f7396974c7a87f1,5c61df0a041e75df0e1ee0e81aa0c09078cdabc1..5c61df0a041e75df0e1ee0e81aa0c09078cdabc1
@@@ -94,6 -94,21 +94,21 @@@ UNSTRING()
    printf '%s\n' "$out"
  }
  
+ RXLITERAL(){
+   # sed -E 's;[].*+?^${}()|\[];\\&;g'
+   local in out=''
+   [ $# -gt 0 ] && in="$*" || in="$(cat)"
+   while [ "$in" ]; do case $in in
+     [.+^\$\{\}\(\)\[\]\*\?\|\\]*)
+       out="${out}\\${in%"${in#?}"}"; in="${in#?}";
+       ;;
+     *)out="${out}${in%%[.+^\$\{\}\(\)\[\]\*\?\|\\]*}"
+       in="${in#"${in%%[.+^\$\{\}\(\)\[\]\*\?\|\\]*}"}"
+       ;;
+   esac; done
+   printf '%s\n' "$out"
+ }
  DBM() {
    local file="$1" cmd="$2"
    local k v key value