Note: original credit to rust video on same by tsoding
Uses finite state machine to implement regex in Golang.
Currently supports '$' and '.' in usual sens of regex that is $ means regex match should end and . means any printable character can be present (only 1 character)
package main
import (
"github.com/dropdevrahul/fmsregex/fmsregex"
)
func main() {
f := fmsregex.FSM{}
f.Compile("abc.g$")
res := f.Match("abceg") // true
res = f.Match("abcfg") // true
res = f.Match("abcega") // false
f.Compile("abcg")
res = f.Match("abcgagagdsajd") // true
f.Compile("abcg$")
res = f.Match("abcgagagdsajd") // false
f.Compile("abc[0-9]$")
res = f.Match("abc5") // true
f.Compile("abc[A-Z]$")
res = f.Match("abcG") // true
f.Compile("abc[xyz]$")
res = f.Match("abcy") // true
}