dcs icon indicating copy to clipboard operation
dcs copied to clipboard

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

Open timb-machine opened this issue 3 years ago • 2 comments

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.

timb-machine avatar Aug 13 '22 09:08 timb-machine

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.

stapelberg avatar Aug 13 '22 09:08 stapelberg

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.

timb-machine avatar Aug 13 '22 09:08 timb-machine