-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Closed
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
What version of Go are you using (go version)?
$ go version go version go1.20.2 darwin/amd64
Does this issue reproduce with the latest release?
yes
and with 1.19 on the Go Playground
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/andrew/Library/Caches/go-build" GOENV="/Users/andrew/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/andrew/Go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/andrew/Go:/Users/andrew/Dropbox/suneido_tests" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.20.2" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/andrew/Dropbox/gsuneido/go.mod" GOWORK="" CGO_CFLAGS="-O2 -g" CGO_CPPFLAGS="" CGO_CXXFLAGS="-O2 -g" CGO_FFLAGS="-O2 -g" CGO_LDFLAGS="-O2 -g" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/dc/0y3gfqnn56g6pd8d3_b5wz300000gn/T/go-build1311023722=/tmp/go-build -gno-record-gcc-switches -fno-common" GOROOT/bin/go version: go version go1.20.2 darwin/amd64 GOROOT/bin/go tool compile -V: compile version go1.20.2 uname -v: Darwin Kernel Version 22.3.0: Mon Jan 30 20:42:11 PST 2023; root:xnu-8792.81.3~2/RELEASE_X86_64 ProductName: macOS ProductVersion: 13.2.1 BuildVersion: 22D68 lldb --version: lldb-1400.0.38.17 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
What did you do?
pat := regexp.MustCompile(`0A|0[aA]`)
fmt.Println(pat.MatchString("0a"))
(https://go.dev/play/p/jCLPp8AXnJB)
What did you expect to see?
true
What did you see instead?
false
I tested on regex101 to confirm that this should match.
(Strangely, it shows golang matching)
It appears to compile incorrectly. Simplify doesn't seem to matter.
syntax.Parse("0A|0[aA]", 0)
fmt.Println(syntax.Compile(re))
0 fail
1* rune1 "0" -> 2
2 rune1 "A" -> 3
3 nop -> 4
4 match
syntax.Parse("0a|0[aA]", 0)
fmt.Println(syntax.Compile(re))
0 fail
1* rune1 "0" -> 2
2 rune "AAaa" -> 3
3 match
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.