Categorygithub.com/vikashmadhow/prefix_regex_matcher
repositorypackage
0.0.0-20250107125810-da75193ffcf0
Repository: https://github.com/vikashmadhow/prefix_regex_matcher.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

Prefix regular expression matcher and lexer

A regular expression implementation that can do partial prefix matching whereby it is supplied a string to match one character at a time and responds if the supplied prefix is a partial match, complete match or a failed match.

This is then used to build a fast lexer.

Regular expression engine

The regular expression engine currently supports the following patterns:

ExpressionMeaning
x*Zero or more of x.
x+One or more of x.
x?Zero or one of x.
x{m,n}k of x where m <= k <= n. If m is not provided it is set to 0. If n is not provided it is set to infinity.
x{m}Same as x{m,m}
x | yx or y.
(x)x as a numbered capturing group, starting from 1. Group 0 is reserved for the whole expression. Precedence is also overridden by ().

Character and character classes

ExpressionMeaning
[a-zAB]Character set: a to z, A and B.
[^a-zAB]Inverse of character set: any character other than a to z, A and B.
.Matches any character.
\dDigits [0-9].
\DNot digits [^0-9].
\sWhitespace [ \t\n\f\r].
\SNot whitespace [^ \t\n\f\r].
\wWord characters [0-9a-zA-Z_].
\WNot word characters [^0-9a-zA-Z_].