summaryrefslogtreecommitdiffstats
path: root/helper/string.inc
diff options
context:
space:
mode:
Diffstat (limited to 'helper/string.inc')
-rw-r--r--helper/string.inc9
1 files changed, 9 insertions, 0 deletions
diff --git a/helper/string.inc b/helper/string.inc
index 0a166708..9f18e4e0 100644
--- a/helper/string.inc
+++ b/helper/string.inc
@@ -12,3 +12,12 @@ trim() {
canonicalize() {
cd -P -- "$(dirname -- "$1")" && printf '%s\n' "$(pwd -P)/$(basename -- "$1")"
}
+
+escape_search() {
+ sed -e 's/[]\/()$*.^|[]/\\&/g'
+
+}
+
+escape_replace() {
+ sed -e 's/[\/&]/\\&/g'
+}