gregex

package
v0.0.0-...-3631402 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

正则表达式.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMatch

func IsMatch(pattern string, src []byte) bool

正则表达式是否匹配

func IsMatchString

func IsMatchString(pattern string, src string) bool

func MatchAllString

func MatchAllString(pattern string, src string) ([][]string, error)

func MatchString

func MatchString(pattern string, src string) ([]string, error)

正则匹配,并返回匹配的列表

func Quote

func Quote(s string) string

转移正则规则字符串,例如:Quote(`[foo]`) 返回 `\[foo\]`

func Replace

func Replace(pattern string, replace, src []byte) ([]byte, error)

正则替换(全部替换)

func ReplaceFunc

func ReplaceFunc(pattern string, src []byte, repl func(b []byte) []byte) ([]byte, error)

正则替换(全部替换),给定自定义替换方法

func ReplaceString

func ReplaceString(pattern, replace, src string) (string, error)

正则替换(全部替换),字符串

func ReplaceStringFunc

func ReplaceStringFunc(pattern string, src string, repl func(s string) string) (string, error)

正则替换(全部替换),给定自定义替换方法

func Validate

func Validate(pattern string) error

校验所给定的正则表达式是否符合规范

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL