Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

package main

import (
    "fmt"
    "github.com/gogf/gf/text/gregex"
)

func main() {
    match, _ := gregex.MatchString(`(\w+).+\-\-\s*(.+)`, `GF is best! -- John`)
    fmt.Printf(`%s says "%s" is the one he loves!`, match[2], match[1])
}

执行后,输出结果为:执行后,输出结果为: 

John says "GF" is the one he loves!

...