Skip to content

Regexp error #70437

Not planned
Not planned
@yupor5

Description

@yupor5

Go version

go 1.23.3

Output of go env in your module/workspace:

set GO111MODULE=on
set GOARCH=amd64
set GOBIN=E:\golang\soft\go1.23.3\bin
set GOCACHE=C:\Users\admin\AppData\Local\go-build
set GOENV=C:\Users\admin\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=E:\golang\soft\gopath\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=E:\golang\soft\gopath
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=E:\golang\soft\go1.23.3
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=E:\golang\soft\go1.23.3\pkg\tool\windows_amd64  
set GOVCS=
set GOVERSION=go1.23.3
set GODEBUG=
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\admin\AppData\Roaming\go\telemetry
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=E:\golang\source8\matapi\go.mod
set GOWORK=
set CGO_CFLAGS=D:\devTool\mingw64\x86_64-w64-mingw32\include
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\admin\AppData\Local\Temp\go-build3390184697=/tmp/go-build -gno-record-gcc-switches

What did you do?

{"match": "\"EventID\":\"(?!462[4-7]\"|4634\"|464[7-8]\"|467[3-4]\"|4688\"|469[89]\"|470[0-5]\"|4719\"|472[02-9]\"|473[0-578]\"|474[0-9]\"|475[0-9]\"|476[0-9]\"|477[0-9]\"|478[0-1]\"|4794\"|479[89]\"|480[0-3]\"|514[02-5]\"|515[0-9]\"|5168\"|537[6-7]\"|641[69]\"|642[0-4]\"|7031\"|7034\"|7036\"|7040\"|7045\")\\d*\"","example": [
      "{\"Computer\":\"DESKTOP-02VFIOJ\",\"EventData\":{\"Data_SubjectUserName\":\"wonder\",\"Data_ProcessId\":\"0x1fd4\",\"Data_HandleId\":\"0x858\",\"Data_ObjectServer\":\"Security\",\"Data_AccessMask\":\"0x1\",\"Data_SubjectUserSid\":\"S-1-5-21-2510928271-3594568744-4108095923-1001\",\"Data_SubjectDomainName\":\"DESKTOP-02VFIOJ\",\"Data_ObjectType\":\"Key\",\"Data_ObjectName\":\"\\\\REGISTRY\\\\MACHINE\\\\SOFTWARE\\\\Classes\\\\CLSID\\\\{41945702-8302-44A6-9445-AC98E8AFA086}\\\\Patterns\\\\8\",\"Data_SubjectLogonId\":\"0x137ee86\",\"Data_AccessList\":\"%%4432\",\"Data_ProcessName\":\"C:\\\\Windows\\\\System32\\\\RuntimeBroker.exe\",\"Data_ResourceAttributes\":\"-\"},\"Source\":\"Microsoft-Windows-Security-Auditing\",\"OpcodeText\":\"信息\",\"Opcode\":\"0\",\"Keywords\":\"审核成功\",\"EventID\":\"4663\",\"UserData\":{},\"Channel\":\"Security\",\"Message\":\"试图访问对象。\",\"timestamp\":\"2021-11-08T11:54:58.1151745+08:00\",\"ProcessName\":\"System\",\"UserID\":\"\",\"TaskText\":\"Registry\",\"LevelText\":\"信息\",\"Level\":\"0\",\"Task\":\"12801\"}"
    ]} 
re,err := regexp.Complie(match)
if  err != nil {
    return err
}

What did you see happen?

report errors: error parsing regexp: invalid or unsupported Perl syntax: (?!

What did you expect to see?

I hope the pro version can solve this problem

Activity

seankhliao

seankhliao commented on Nov 19, 2024

@seankhliao
Member

closing as working as intended.

ianlancetaylor

ianlancetaylor commented on Nov 19, 2024

@ianlancetaylor
Contributor

See https://swtch.com/~rsc/regexp/regexp1.html for why Go regular expressions do not support ?!.

By the way, there is no pro version.

yupor5

yupor5 commented on Nov 20, 2024

@yupor5
Author

"github.com/dlclark/regexp2"
You can use this, but it doesn't have an ideal version. Regux has been updated and the previous one is even more unusable. I found that version 22 can still be used, but there are still parsing issues,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ianlancetaylor@seankhliao@yupor5@gabyhelp

        Issue actions

          Regexp error · Issue #70437 · golang/go