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

Multiline (and maybe other) flags from RE2 don't appear to work in DCS #115

Open
timb-machine opened this issue Aug 13, 2022 · 2 comments
Open

Comments

@timb-machine
Copy link

According to my reading of https://github.com/google/re2/blob/main/doc/syntax.txt, ((?sm).*fprintf.*fclose.*) should allow for multiline matches to be treated as a single line to match printf on one line, fclose on another, but this does not seem to work.

I had a quick chat with Michael on Twitter and he confirmed he could see what I was saying, so I don't think it's just me (although that's still possible :)). I will take a look at RE2 myself to see if I can spot an upstream option, but Michael advised we ought to track it here also.

@stapelberg
Copy link
Contributor

Thanks for filing this issue!

I will take a look at RE2 myself to see if I can spot an upstream option

Note that dcs is using a slightly modified version of https://pkg.go.dev/github.com/google/codesearch/regexp, which in turn is at least partly copied from Go’s regexp package per: https://github.com/google/codesearch/blob/8ba29bd255b740aee4eb4e4ddb5d7ec0b4d9f23e/regexp/copy.go#L5

You can find the source of Go’s regexp package at https://cs.opensource.google/go/go/+/master:src/regexp/, but you probably would want to clone https://github.com/golang/go anyway to make modifications (like additional printfs) and try them out.

@timb-machine
Copy link
Author

Makes sense. As a quick test, I created https://regex101.com/r/weTm0i/1 which I believe uses RE2. In this case, it seems to work.

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