Subject: Re: bug#52558: Option for easier typing of regexps

From: Jim Porter <[email-masked]>
Date: Mon, 20 Dec 2021 11:46:32 -0800

On 12/19/2021 3:56 AM, Lars Ingebrigtsen wrote:
> I think it would be really confusing to have a different regexp syntax
> when prompting interactively to when you're writing code, so I don't
> think this would be a good idea.  Anybody else have a different opinion?

I think this depends on how people use Emacs. While there's definitely 
some potential for confusion if you switch between entering Emacs 
regexps interactively or by writing Elisp, there's also potential for 
confusion if you often write regexps for external tools from Emacs. For 
example, if you use one of the "modern" recursive grep-like tools (ack, 
ag, ripgrep, etc), most of them use PCRE syntax (or something close to 
PCRE). It's easy to forget that Isearch uses BRE but your preferred 
rgrep-like tool uses ERE/PCRE.

I've attempted to resolve this issue in the other direction in 
Urgrep[1], which provides a unified way of running all these recursive 
grep-like tools. Specifically, it defaults to accepting BRE syntax and 
then, if the tool only accepts ERE/PCRE, it converts the BRE input into 
ERE/PCRE. That's not perfect either since then you end up in a situation 
where to use PCRE features, you have to enter them in a BRE-like syntax, 
which I find pretty confusing too. (This behavior is customizable in 
Urgrep, so if you like ERE/PCRE, you can set those as the input syntax.)

I'm not sure this makes the decision about what to do any easier though. 
In fact, it probably just muddies the waters further. :)

[1] https://github.com/jimporter/urgrep