Parcourir la source

Fuck up restored in regex

Foppe Hemminga il y a 6 ans
Parent
commit
932c482e46
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      main.go

+ 1 - 1
main.go

@@ -186,7 +186,7 @@ func (a Attack) String() string {
 }
 
 func replaceLinks(news string) string {
-	re := regexp.MustCompile(`<[aA].*?href\s?=\s?"?https?://torn.com/profiles.php\?XID=(.*?)[ "]?(?: .*?)?>(.*?)</a>`)
+	re := regexp.MustCompile(`<[aA].*?href\s?=\s?"?https?://torn.com/profiles.php\?XID=(\d+)[ "]?(?: .*?)?>(.*?)</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})")