[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regular expression creation [was: Re: Emacs Lisp's future]

From: Daniel Colascione
Subject: Re: Regular expression creation [was: Re: Emacs Lisp's future]
Date: Fri, 19 Sep 2014 11:04:41 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1

On 09/18/2014 02:54 PM, Alexis wrote:
> Daniel Colascione writes:
>> On 09/17/2014 07:07 PM, Alexis wrote:
>>> i like this suggestion. i'm rather comfortable with Perl5 REs, and can
>>> find myself frustrated trying to create REs in ELisp. Having said that,
>>> the issue is not usually the syntax of ELisp REs per se (e.g. needing to
>>> escape things like capturing parentheses or the alternatives pipe); it's
>>> needing to escape various things /further/ because REs can only be
>>> specified in the form of a standard ELisp string. On several occasions
>>> i've ended up using a combination of pcre-to-elisp and re-builder to try
>>> to work out if the problem is too few backslashes, too many backslashes,
>>> or both.
>> That's why we have rx.
> i find rx .... unwieldy. For me, rx is to PCREs as a putative function
> 'apply-function-to-each-element-of-sequence' is to 'mapcar'. i don't
> want an English-language wrapper for regular expressions; i want regular
> expressions that don't suffer from backslashitis. And, given the several
> discussions by a number of people over the last several months -
> including recently - about alternatives to the current RE-creation
> system in Emacs, it seems to me that rx is hardly the final piece of the
> Emacs Lisp RE puzzle.

rx is sometimes awkward for small patterns, but it's a boon for larger
ones: see the work I did in compile.el, which involved rewriting the
"gnu" pattern with rx. It's also pretty easy to embed string regular
expressions inside rx forms.

Anyway, I'd love to see pcre2el or equivalent in core. It's a nice
packing for converting between regular expression formats.

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]