summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-12-25 15:15:38 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-12-25 15:15:38 +0100
commit384585ae8848a5f16d570c5febf16eaa7b2084c6 (patch)
treeeadee7d75aca13c17a5c15f7ec08646eb28dd0e0
parent422a15a09efd2d44fe53c5ce2c46bc8b5aee08e6 (diff)
minor fixes
-rw-r--r--href.go2
-rw-r--r--re.go3
2 files changed, 3 insertions, 2 deletions
diff --git a/href.go b/href.go
index b18b3f3..bd4cec6 100644
--- a/href.go
+++ b/href.go
@@ -56,7 +56,7 @@ func getTitle(uri string) (string, error) {
func getLinks(s string) (ret []string) {
for _, v := range strings.Fields(s) {
switch {
- case strings.HasPrefix(v, "www"):
+ case strings.HasPrefix(v, "www."):
v = "http://" + v
fallthrough
case strings.HasPrefix(v, "http:"), strings.HasPrefix(v, "https:"):
diff --git a/re.go b/re.go
index 714afcf..90a9fda 100644
--- a/re.go
+++ b/re.go
@@ -11,7 +11,8 @@ func re(s, r string) string {
return ""
}
z := strings.Split(r[2:], string(r[1]))
- if len(z) < 2 {
+ // match s// and s///
+ if len(z) < 2 || len(z) > 3 {
return ""
}
re, err := regexp.Compile(z[0])