moar icon indicating copy to clipboard operation
moar copied to clipboard

Regexps are not PCRE compatible

Open kivra-riccar opened this issue 6 months ago • 2 comments

Was really hoping that moar would support PCRE so that you could easily search for things like xxx not followed by yyy, as in xxx(?!yyy), which less does not (on most systems). Instead, it seems that moar uses the default Go RE2 library which is not standard for any Unix tools. RE2 is conservative in what it can do, in order to avoid DoS attacks. But a tool like moar does not need to be as conservative, and it would be much more user friendly to link it against PCRE.

kivra-riccar avatar Jul 08 '25 08:07 kivra-riccar

This seems to be the way to go: https://github.com/GRbit/go-pcre/

The reason for picking the Go standard library regex implementatio (not RE2) was that it was there.

walles avatar Jul 09 '25 20:07 walles

But it seems like that thing is just a wrapper around some C library.

Using that seems difficult given that I cross compile Windows releases from macOS.

walles avatar Jul 09 '25 20:07 walles