extractstatic

package module
v0.0.0-...-a6622f7 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2019 License: MIT Imports: 3 Imported by: 0

README

extractstatic

GoDoc CI Status Coverage Status Go Report Card

Package extractstatic extracts static parts of regexpes.

Useful to prefilter complicated regexp matches on large data sets. See prefilter benchmark for example.

Example

static, _ := extractstatic.String(`really\s?complicated.*regexp`)
fmt.Println(static) // Output: [really complicated regexp]

Documentation

Overview

Package extractstatic extracts static parts of regexpes.

Useful to prefilter complicated regexp matches on large data sets.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Regexp

func Regexp(r *regexp.Regexp) ([]string, error)

Regexp extracts all static parts from the given regexp.

func RegexpLongest

func RegexpLongest(r *regexp.Regexp) (string, error)

RegexpLongest extracts the longest static string from the given regexp.

func String

func String(r string) ([]string, error)

String extracts all static parts from the given regexp. Returns a syntax error if regexp can't be parsed.

Example
package main

import (
	"fmt"

	"github.com/bastjan/extractstatic"
)

func main() {
	static, _ := extractstatic.String(`really\s?complicated.*regexp`)
	fmt.Println(static)
}
Output:

[really complicated regexp]

func StringLongest

func StringLongest(r string) (string, error)

StringLongest extracts the longest static string from the given regexp. Returns a syntax error if regexp can't be parsed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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