Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 校验正则表达式校验的结果与预期不符 #82

Open
jojoshuai opened this issue Jun 11, 2024 · 1 comment
Open

[Bug] 校验正则表达式校验的结果与预期不符 #82

jojoshuai opened this issue Jun 11, 2024 · 1 comment

Comments

@jojoshuai
Copy link

Describe the bug
当vd为某些正则表达式时,表现的结果与预期不符

To Reproduce
Steps to reproduce the behavior:
go get github.com/bytedance/go-tagexpr/v2@latest
run code: with 'go run'

Expected behavior
判断效果应相同

version:
github.com/bytedance/[email protected]

Environment:
GOVERSION='go1.22.2'

@KafuuEriri
Copy link

我也遇到同样的问题,定位到是decoder包下tag.go 66行

if _, ok := field.Tag.Lookup(config.ValidateTag); ok {
    needValidate = true
}

这里提取tag的值时使用了value, err := strconv.Unquote(qvalue),而带有正则表达式的tag会抛出err:invalid syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants