github.com/gogf/gf@v1.16.9/.example/text/gregex/gregex.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/gogf/gf/text/gregex"
     7  )
     8  
     9  func main() {
    10  	match, _ := gregex.MatchString(`(\w+).+\-\-\s*(.+)`, `GF is best! -- John`)
    11  	fmt.Printf(`%s says "%s" is the one he loves!`, match[2], match[1])
    12  }