summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-06-17 18:55:14 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-06-17 18:55:14 +0200
commit0e6959e1fc8bfc0894fef5ca730f000cd10c7818 (patch)
tree4c0910ba39607036df8341b56f6abc2c3d27f805
parent4f6b78155e6a4ab1128b81b936e451202c76eedd (diff)
Use bash regex instead of sed -rv1.4.3
sed -r is not supported on OS X and using bash actually makes the code easier. Signed-off-by: Florian Pritz <bluewind@xinu.at>
-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