summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Ørsted Andresen <bo.andresen@zlin.dk>2008-01-02 11:45:01 +0000
committerBo Ørsted Andresen <bo.andresen@zlin.dk>2008-01-02 11:45:01 +0000
commit9574c52ad79640d513c76d307c8bebad9d05e130 (patch)
tree751635da5431b4395021acbfdb7f7603658f3a12
parent41ad6ad4f85f3da7964c353682eb31e7a92ffb38 (diff)
downloadwgetpaste-9574c52ad79640d513c76d307c8bebad9d05e130.tar.gz
Use more portable regular expressions for sed.
-rwxr-xr-xwgetpaste14
1 files changed, 7 insertions, 7 deletions
diff --git a/wgetpaste b/wgetpaste
index 0b26bc9..819945d 100755
--- a/wgetpaste
+++ b/wgetpaste
@@ -44,8 +44,8 @@ EXPIRATIONS_ca="Never 5%minutes 10%minutes 15%minutes 30%minutes 45%minutes 1%ho
4%hours 8%hours 12%hours 1%day 2%days 3%days 1%week 2%weeks 3%weeks 1%month 2%months \
3%months 4%months 5%months 6%months 1%year"
POST_ca="s=Submit+Post name description type expiry % content"
-REGEX_URL_ca='s|^.*content="[0-9]\+;\(http://[^/]\+/[0-9]\+\)".*$|\1|p'
-REGEX_RAW_ca='s|^\(http://[^/]\+/\)\([0-9]\+\)$|\1raw/\2|'
+REGEX_URL_ca='s|^.*content="[0-9]*;\(http://[^/]*/[0-9]*\)".*$|\1|p'
+REGEX_RAW_ca='s|^\(http://[^/]*/\)\([0-9]*\)$|\1raw/\2|'
# rafb
LANGUAGES_rafb="C C89 C99 C++ C# Java Pascal Perl PHP PL/I Python Ruby SQL VB Plain%Text"
POST_rafb="% nick desc lang % cvt_tabs text"
@@ -63,10 +63,10 @@ qbasic robots ruby scheme smarty sql tcl vb vbnet visualfoxpro xml"
EXPIRATIONS_osl="Never 1%day 1%month"
EXPIRATION_VALUES_osl="f d m"
POST_osl="paste=Send poster % format expiry % code2"
-REGEX_RAW_osl='s|^\(http://[^/]\+/\)\([0-9]\+\)$|\1pastebin.php?dl=\2|'
+REGEX_RAW_osl='s|^\(http://[^/]*/\)\([0-9]*\)$|\1pastebin.php?dl=\2|'
# tinyurl
POST_tinyurl="submit=Make+TinyURL! % % % % % url"
-REGEX_URL_tinyurl='s|^<input type=hidden name=tinyurl value="\?\([^"]\+\)"\?>$|\1|p'
+REGEX_URL_tinyurl='s|^<input type=hidden name=tinyurl value="\?\([^"]*\)"\?>$|\1|p'
### errors
die() {
@@ -377,10 +377,10 @@ geturl() {
regex=REGEX_URL_$ENGINE
if [[ -n ${!regex} ]]; then
[[ needstdout = $1 ]] && return 0
- sed -n "${!regex}" <<< "$*"
+ sed -n -e "${!regex}" <<< "$*"
else
[[ needstdout = $1 ]] && return 1
- sed -n 's|^.*Location:\ \(http://[^\ ]\+\).*$|\1|p' <<< "$*"
+ sed -n -e 's|^.*Location: \(http://[^ ]*\).*$|\1|p' <<< "$*"
fi
}
@@ -407,7 +407,7 @@ while [[ -n $1 ]]; do
ARGS[${#ARGS[*]}]="$1"
;;
-* )
- for shortarg in $(sed 's|.| -&|g' <<< "${1#-}"); do
+ for shortarg in $(sed -e 's|.| -&|g' <<< "${1#-}"); do
ARGS[${#ARGS[*]}]="$shortarg"
done
;;