prefix

package
v0.4.31 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matcher added in v0.4.28

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

func NewMatcher added in v0.4.28

func NewMatcher(pattern string) *Matcher

NewMatcher returns a new prefix Cutter.

WithPattern provides a user-specified sequence of white-space-separated tokens to skip when looking for the start of a table row or ruler.

Each token may appear any number of times, but the tokens must appear in the provided order.

The pattern provided will be converted into a regular expression of the form (expanded for readibility):

^\s* ( {token-1} \s* )* ( {token-2} \s* )* ...

The default pattern is simply: "^\s*"

Example Patterns:

"//":	golang comments
"#":	shell comments
"// #": shell comments within go code
		matches >1 of white-space separated "//"'s followed by >1 "#"

For example, the pattern "// #" would allow the following table to be reformatted:

// // # #  | one  |   two   |  three  |
// // # #  | ---- | ------- | ------- |
// // # #  | data | numbers | letters |

func (*Matcher) Match added in v0.4.28

func (p *Matcher) Match(in string) string

func (*Matcher) String added in v0.4.28

func (p *Matcher) String() string

Jump to

Keyboard shortcuts

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