• 正则提取网页中文字符
  • // 正则提取网页内所有中文
    func tiquCn(html string) string {
       re := regexp.MustCompile(`[\p{Han}]+`)
       // 提取匹配的中文字符
       matches := re.FindAllString(html, -1)
       // 输出匹配结果
       jg := []string{}
       for _, match := range matches {
          jg = append(jg, match)
       }
       return strings.Join(jg, " ")
    }