Re: [code] [textadept] Textadept 9 poll: Lua patterns or Regex?

From: Mitchell <m.att.foicica.com>
Date: Tue, 5 Jul 2016 20:59:29 -0400 (EDT)

Hi Giovanni,

On Sun, 3 Jul 2016, Giovanni Salmeri wrote:

> Dear Mitchell
>
> I for myself use a modified version of
> http://foicica.com/wiki/regex-searches/file/regex-find.lua, so I would
> welcome very much a regex engine in Textadept. In my opinion the
> problem with Lua patterns is not the fact that they are limited (the
> regex engine of Scintilla I use is much more limited), but simply the
> fact that they are different from anything else I use (except,
> obviously, Lua scripts themselves).
>
> On a side note: I modified the above script in order to allow
> substitutions like s/^/x/g or s/$/x/g (for adding x at the beginning or
> at the end of a line), which is something I consider almost essential
> but that I have found rather tricky to implement. Would the new solution
> you are proposing allow this?

I'm not exactly sure, but I think you'd have to do something like
"s/^./x\0/g" or "s/.$/\0x/g" (the \0 contains the entire match -- in
this case the single character to keep). You probably know more about
regex than me so your assistance on this would be valuable when the time
comes.

>> Also, if Regex wins, I'll likely be removing the Lua code execution
>> in pattern replacements (e.g. `%(string.upper('%1')`). In the very
>> few instances I've actually used it, it's not as reliable as I'd
>> expect it to be.
>
> The same for me, with this syntax I managed more than once to stall
> Textadept. On the other side, I would miss for example exactly
> string.upper and string.lower, considering that TRE lacks the Vim-like
> syntax \l \u \L \U \E. Perhaps Lua code execution could be kept as
> a non-documented feature for the adventurous?

I think this would be something I'd put on the wiki as a possible
extension, as it wouldn't be very hard to implement.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Tue 05 Jul 2016 - 20:59:29 EDT

This archive was generated by hypermail 2.2.0 : Wed 06 Jul 2016 - 06:52:53 EDT