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

From: Mitchell <m.att.foicica.com>
Date: Fri, 15 Jul 2016 17:34:22 -0400 (EDT)

Hi Giovanni,

On Fri, 8 Jul 2016, Giovanni Salmeri wrote:

>>> 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).
>
> Not exactly, because s/^/x/ matches also empty lines, while s/^./x\0/
> does not. One could write s/^.?/x\0/ but the problem would remain:
> for this to work in empty lines the replace command in Textadept should
> handle correctly zero-length captures. Obviously, often s/^./x\0/ is
> more desirable, but it is different (and when the effect would be the
> same as s/^/x/ , it is a little more verbose...).

Well unfortunately I do not know very much on this matter and cannot offer
much input. Perhaps you will have some sort of idea how to proceed
whenever you upgrade to Textadept 9 and try the new regex library.

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 Fri 15 Jul 2016 - 17:34:22 EDT

This archive was generated by hypermail 2.2.0 : Sat 16 Jul 2016 - 06:48:57 EDT