Re: [code] textadept regexp matching

From: Chris Emerson <c-ta.att.mail.nosreme.org>
Date: Wed, 7 May 2014 12:49:09 +0100

Hi Pavel,

On Wed, May 07, 2014 at 02:18:26PM +0300, tastyminerals wrote:
> I am trying to match "matched - 0" string with the following lua
> pattern: matched%s-%s0.
> I know that the example string contains exactly whitespaces, but the
> match is not happening.
>
> 1. What am I doing wrong?

The problem is that '-' is a Lua pattern metacharacter, so you need to
escape it. Try: matched%s%-%s0 .

> 2. What is the equivalent of ^[^word]*$ in lua patterns?

If I understand correctly, it's the same.

> 3. I've read appendix on lua patterns and became disappointed, lua
> patterns seem to lack functionality of regular regexps, is that the
> case?

That's correct, Lua patterns are not as powerful as regexps.

That annoys me too, so I implemented regexes for TA, in case that's of any
use to you:

https://github.com/jugglerchris/ta-regex

Regards,

Chris

-- 
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 Wed 07 May 2014 - 07:49:09 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 May 2014 - 06:26:16 EDT