Be a bit more strict about protocol scheme in URL matching. - plumb - Open certain URL patterns with an ad-hoc opener (plumber)
(HTM) hg clone https://bitbucket.org/iamleot/plumb
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) changeset 43d2c08e673a3340cae71c4fe153fff272484406
(DIR) parent ee6593051dce2bad6797f84289ecd69f58a5957b
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Mon, 26 Mar 2018 09:40:13
Be a bit more strict about protocol scheme in URL matching.
Instead of just printing all `://' lines match the `[[:alnum:]]+://.+' RE to
possibly get rid of extra characters before the protocol scheme.
Now lines like `(http://www.example.org' are correctly converted to
`http://www.example.org'.
Diffstat:
dplumb | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff -r ee6593051dce -r 43d2c08e673a dplumb
--- a/dplumb Mon Mar 26 09:33:09 2018 +0200
+++ b/dplumb Mon Mar 26 09:40:13 2018 +0200
@@ -57,8 +57,8 @@
match($0, /"[[:alnum:]]+:\/\/[^]]+"/) ||
match($0, /'"'"'[[:alnum:]]+:\/\/[^]]+'"'"'/)) {
print substr($0, RSTART + 1, RLENGTH - 2)
- } else {
- print $0
+ } else if (match($0, /[[:alnum:]]+:\/\/.+/)) {
+ print substr($0, RSTART, RLENGTH)
}
}
' |