Explorar el Código

Fuck up restored in regex

Foppe Hemminga hace 6 años
padre
commit
932c482e46
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      main.go

+ 1 - 1
main.go

@@ -186,7 +186,7 @@ func (a Attack) String() string {
 }
 }
 
 
 func replaceLinks(news 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>`)
 	// re := regexp.MustCompile(`XID=(\d+)"?>(.*?)</a>`)
 	fmt.Println(re.FindAllStringSubmatch(news, -1))
 	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://torn.com/profiles.php?XID=${1})")