-
-
Notifications
You must be signed in to change notification settings - Fork 602
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
match() captures are malformed #1114
Comments
I created an extended version for an existing test case to cover this case too. Before: yq/pkg/yqlib/operator_strings_test.go Lines 32 to 39 in df32bae
After: {
description: "Match with global capture group",
document: `abc abc`,
expression: `[match("(ab)(c)"; "g")]`,
expected: []string{
"D0, P[], (!!seq)::- string: abc\n offset: 0\n length: 3\n captures:\n - string: ab\n offset: 0\n length: 2\n - string: c\n offset: 2\n length: 1\n- string: abc\n offset: 4\n length: 3\n captures:\n - string: ab\n offset: 4\n length: 2\n - string: c\n offset: 6\n length: 1\n",
},
}, Hope it helps 👍 |
mikefarah
added a commit
that referenced
this issue
Feb 20, 2022
Fixed in 4.20.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The
match()
function returns a corruptcaptures
array, when there are multiple capture groups.Update: depending on the output-format, yq crashes in other cases.
Version of yq: 4.20.1
Operating system: mac
Installed via: binary homebrew
Input Yaml
abc
Command
The command you ran:
Actual behavior
--output-format yaml
The
captures
list looks totally unparsable.--output-format <not yaml>
Crash:
Expected behavior
--output-format yaml
--output-format <not yaml>
Something equivalent.
The text was updated successfully, but these errors were encountered: