package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?i)((http(s)?|ftp)?:\/\/|www\.)dc([0-9])+\.4shared\.com\/([a-z0-9\/@#$,%*_-])+\.?(mp3|mp4|pdf|txt|doc|pps|epub|png|gif|jpg|jpeg|3gp|avi|mpg|wmv|mov|mkv|apk)?`)
var str = `http://dc778.4shared.com/img/4wW4UT5jba/9f90279b/dlink__2Fdownload_2F4wW4UT5jba_3Ftsid_3D20150615-114008-b7f2dbf8_26lgfp_3D1000_26sbsr_3D7c546ac8da497fae73b10095dc49e8d24e610417724fcf65/preview.wmv
`
if len(re.FindStringIndex(str)) > 0 {
fmt.Println(re.FindString(str),"found at index",re.FindStringIndex(str)[0])
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/