import (
"bufio"
"bytes"
"fmt"
"io/ioutil"
"net/http"
"os"
"regexp"
"strconv"
"strings"
)
func ListHref(html string) {
var hrefRegexp = regexp.MustCompile("(?m)<a.*?[^<]>.*?</a>")
match := hrefRegexp.FindAllString(html, -1)
if match != nil {
for i, v := range match {
fmt.Println("[", i, "]-", v)
}
}
}
Go正则提取html A 连接标签
点赞
收藏