Versions Compared

Key

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

基本介绍

gregex提供了对正则表达式的支持,底层是对标准库regexp的封装,极大地简化了正则的使用,并采用了解析缓存设计,提高了执行效率。

...

使用方式:

Code Block
languagego
import "github.com/gogf/gf/v2/text/gregex"

...

接口文档

https://

...

...

...

简单示例:

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])
}

执行后,输出结果为: 

...

相关文档

Children Display
alltrue
excerptTypesimple






Panel
titleContent Menu

Table of Contents