Skip to content

lizongying/go-re

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-re

Re Selector in Golang for Easier Use.

go-re

document

中文

Install

go get github.com/lizongying/go-re

Usage

package main

import (
	"fmt"
	"github.com/lizongying/go-re/re"
)

func main() {
	html := `<html class="abc">....<div class="def">....</div><div class="gkl">123</div></html>`
	s, _ := re.NewSelectorFromStr(html)

	i8 := s.One(`(\d+)`).Int8()
	//123
	fmt.Println(i8)

	arr := s.Many(`(\d+)`)
	//123
	fmt.Println(arr)

	m := s.ManySelector(`>([^<]+)(<)`)
	n := m[4].One(`(\d+)`)
	//123
	fmt.Println(n)
}

Releases

No releases published

Packages

No packages published

Languages