Przeglądaj źródła

Fuck up restored in regex

Foppe Hemminga 6 lat temu
rodzic
commit
2ae50b5dae
1 zmienionych plików z 2 dodań i 2 usunięć
  1. 2 2
      main.go

+ 2 - 2
main.go

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