In the default Perl mode, it's impossible to configure RE2::Options for the multi-line ^$ anchors. The only way to enable multi-line anchors in Perl mode is to prepend all relevant patterns with (?m), which is (1) rather inconvenient (2) less efficient than configuring that via RE2::Options, and (3) inconsistent with other configuration options (longest-match, case-insensitivity, etc.)
Is there any strong reasoning behind this design?
In the default Perl mode, it's impossible to configure RE2::Options for the multi-line ^$ anchors. The only way to enable multi-line anchors in Perl mode is to prepend all relevant patterns with (?m), which is (1) rather inconvenient (2) less efficient than configuring that via RE2::Options,
(1) rather inconvenient (2) less efficient than configuring that via RE2::Options,Neither of these is really true. It's trivial to write "(?m)"+s, and RE2 will parse those extra 4 bytes quite efficiently.
This came up in https://groups.google.com/g/re2-dev/c/_1vmeAgH3hM/ a few years ago, but my position hasn't changed since then because, well, despite my continued desire for a consistent interface, trying to improve this particular aspect of the interface is too much risk for too little reward. :(
I fully agree that the reward is not that big -- this is not a critical issue to any extent. But if the only reason holding us back from fixing it is the risk of breaking things, then there's no risk and guaranteed 100% backward compatibility. As I said in the original message, we don't touch the semantics of one_line. Instead, we introduce an additional setting (naming is discussible -- multi_line/one_line_new/one_line_ex/one_line_override/etc). When undefined, it does nothing; when defined, it overrides one_line. Done!
Now, where all these patches & propositions are coming from? I'm currently working on a modification of RE2 to enable (1) matching over rewindable streams (e.g., running a regexp over huge files that can't be mapped all at once, live TCP streams, etc.) and (2) regexp switches / lexers. Somewhat similar to Hyperscan -- but in a compact cross-platform library that is RE2. These modifications are not going to break any existing APIs or RE2-dependent code -- they'll introduce a new matcher interface just like RE2::Set does. During work, a few things caught my eye, so I'm proposing simple and safe ones to fix. Hope this makes sense.