summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fb.in5
1 files 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