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

From: Chris Emerson <>
Date: Sun, 3 Jul 2016 09:17:26 +0100

Hi Mitchell,

On Sat, Jul 02, 2016 at 11:07:10PM -0400, Mitchell wrote:
> The question I have for you is would you prefer to have Regex
> searches instead of Lua pattern searches?

As someone who implemented regexes using LPEG so that I can use them in
Textadept, I think this is well worth the tradeoff. Personally I don't
think either Lua patterns or Scintilla's not-actually-regular-expressions are
good enough for a programmer's editor. From reading the description of TRE
(no other experience) it seems to be the right kind of RE engine for TA
(complete and efficient).

> 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.

I've never used this, but then I don't use Textadept's search UI at all...

> I'd appreciate your thoughts and comments on this very much.

If this happens I'm personally all that interested in the UI end of it,
but more the API. The things I'm likely to want to use it for:

* search for next match
* find all non-overlapping matches
* highlight all matches
* match against one line (including returning captures) for implementing
the vi "s/(.*)-(.*)/\2_\1/" type of operation. If compiling the regex
isn't very fast I'd ideally want to be able to re-use the same compiled
regex each time.

I'm not saying the above should all be provided directly - as long as
the right primitives are available to Lua I'm happy. (That's why I use
Textadept in the first place! :-) )



You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Sun 03 Jul 2016 - 04:17:26 EDT

This archive was generated by hypermail 2.2.0 : Sun 03 Jul 2016 - 06:53:05 EDT