easyregexp

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

Go Report Card

easyregexp

以前用perl使用正则表达式习惯固化了,打算封装一下标准包,提供一些能快速处理文本的方法

支持以下方法:

  • Match
  • Catch
  • CatchAll
  • ReplaceAll
  • Split

输入参数可以是 string / []byte / io.Reader

Documentation

Index

Constants

View Source
const MaxCompiledRegex = 1024

max number of cached *EasyRegexp

Variables

This section is empty.

Functions

func Catch

func Catch(pattern string, i interface{}) []string

func CatchAll

func CatchAll(pattern string, i interface{}) [][]string

func FCatch

func FCatch(pattern string, filepath string) []string

func FCatchAll

func FCatchAll(pattern string, filepath string) [][]string

func FMatch

func FMatch(pattern string, filepath string) bool

func FReplaceAll

func FReplaceAll(pattern string, filepath string, repl string) string

func FSplit

func FSplit(pattern string, filepath string) []string

func Match

func Match(pattern string, i interface{}) bool

func ReplaceAll

func ReplaceAll(pattern string, i interface{}, repl string) string

func Split

func Split(pattern string, i interface{}) []string

Types

type EasyRegexp

type EasyRegexp struct {
	// contains filtered or unexported fields
}

contain pattern string and count

func NewEasyRegexp

func NewEasyRegexp(pattern string) *EasyRegexp

func (*EasyRegexp) Catch

func (er *EasyRegexp) Catch(i interface{}) []string

func (*EasyRegexp) CatchAll

func (er *EasyRegexp) CatchAll(i interface{}) [][]string

func (*EasyRegexp) FCatch

func (er *EasyRegexp) FCatch(filepath string) []string

func (*EasyRegexp) FCatchAll

func (er *EasyRegexp) FCatchAll(filepath string) [][]string

func (*EasyRegexp) FMatch

func (er *EasyRegexp) FMatch(filepath string) bool

func (*EasyRegexp) FReplaceAll

func (er *EasyRegexp) FReplaceAll(filepath string, repl string) string

func (*EasyRegexp) FSplit

func (er *EasyRegexp) FSplit(filepath string) []string

func (*EasyRegexp) Match

func (er *EasyRegexp) Match(i interface{}) bool

func (*EasyRegexp) ReplaceAll

func (er *EasyRegexp) ReplaceAll(i interface{}, repl string) string

func (*EasyRegexp) Split

func (er *EasyRegexp) Split(i interface{}) []string

Jump to

Keyboard shortcuts

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