Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Go read url from file (change target to your desired domain)
package main
import (
func main() {
argsWithoutProg := os.Args[1]
content, err := ioutil.ReadFile(argsWithoutProg)
if err != nil {
str1 := string(content)
re := regexp.MustCompile(`(https:\/\/www\.target\/?)([a-zA-Z0-9\-\.]){1,200}`)
//fmt.Printf("Pattern: %v\n", re.String()) // print pattern
//fmt.Println(re.MatchString(str1)) // true
submatchall := re.FindAllString(str1, -1)
for _, element := range submatchall {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment