瀏覽代碼

Fuck up restored in regex

Foppe Hemminga 6 年之前
父節點
當前提交
3ab5816044
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      main.go

+ 3 - 3
main.go

@@ -186,10 +186,10 @@ func (a Attack) String() string {
 }
 
 func replaceLinks(news string) string {
-	re := regexp.MustCompile(`<[aA].*?href\s?=\s?"?https?://torn.com/profiles.php\?XID=(\d+)[ "]?(?: .*?)?>(.*?)</a>`)
-	// re := regexp.MustCompile(`XID=(\d+)"?>(.*?)</a>`)
+	// re := regexp.MustCompile(`<[aA].*?href\s?=\s?"?(.*?)[ "]?(?: .*?)?>(.*?)</a>`)
+	re := regexp.MustCompile(`<[aA].*?href\s?=\s?"?https?://www.torn.com/profiles.php\?XID=(\d+)[ "]?>(.*?)</a>`)
 	fmt.Println(re.FindAllStringSubmatch(news, -1))
-	return re.ReplaceAllString(news, "[${2} [${1}]](https://torn.com/profiles.php?XID=${1})")
+	return re.ReplaceAllString(news, "[${2} [${1}]](https://www.torn.com/profiles.php?XID=${1})")
 	//return news
 }