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

Enable multiline regexp mode for patterm matcher #861

Merged
merged 9 commits into from
May 13, 2022
4 changes: 4 additions & 0 deletions interp/interp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,10 @@ var runTests = []runTest{
"[[ -L a ]] && echo x; ln -s b a; [[ -L a ]] && echo y;",
"y\n",
},
{
"[[ \"multiline\ntext\" == *text* ]] && echo x; [[ \"multiline\ntext\" == *multiline* ]] && echo y",
"x\ny\n",
},
{
"mkdir a; cd a; test -f b && echo x; >b; test -f b && echo y",
"y\n",
Expand Down
2 changes: 1 addition & 1 deletion interp/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ func match(pat, name string) bool {
if err != nil {
return false
}
rx := regexp.MustCompile("^" + expr + "$")
rx := regexp.MustCompile("(?m)^" + expr + "$")
return rx.MatchString(name)
}

Expand Down