From 0e6959e1fc8bfc0894fef5ca730f000cd10c7818 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 17 Jun 2015 18:55:14 +0200 Subject: Use bash regex instead of sed -r sed -r is not supported on OS X and using bash actually makes the code easier. Signed-off-by: Florian Pritz --- fb.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fb.in b/fb.in index 0aac2fb..69159de 100644 --- a/fb.in +++ b/fb.in @@ -247,8 +247,9 @@ read_string() { } id_from_arg() { - if printf "%s" "$1" | grep -qE "^https?://"; then - printf "%s" "$1" | sed -r 's/https?:\/\/[^\/]+\/([^\/]+).*/\1/' + local regex="https?:\/\/[^\/]+\/([^\/]+).*" + if [[ $1 =~ $regex ]]; then + printf "%s" "${BASH_REMATCH[1]}" else printf "%s" "$1" fi -- cgit v1.2.3-24-g4f1b