Re: [code] Regular expression idiosyncrasy

From: Danny MacMillan <foicica.att.nekulturny.org>
Date: Wed, 25 Oct 2017 18:32:13 -0600

On 2017-10-25 15:45, Danny MacMillan wrote:
>
> I'm a little confused by how textadept does regular expression search
> and replace. Suppose I have a file with these contents this:
>
> apples
> oranges
> bananas
>
> And I do a regular expression search and replace:
>
> Find: ^(.*)$
> Replace: I like \1 ... I really like \1
>
> This is what textadept gives me:
>
> I like apples
> ... I really like apples
> I like oranges
> ... I really like oranges
> I like bananas ... I really like bananas
>
> But this isn't what I would ever want. In the tool I used to use, the
> $ matches the end of the line which prevents .* from matching it.
>
> Is there a way to get this to work the way I want? in case it's not
> clear, the newlines preceding the ellipses are unwanted.

I'm reading the TRE documentation and I found some options I'm trying
out. This regular expression kills textadept (consumes 30% of my CPU,
goes to not responding, never comes back). Maybe it's not the best
regular expression in the world but it shouldn't make textadept die.
Maybe a timeout is in order?

(?-n)(\n|$)(.*)(\n|$)

Achievement Unlocked!

-- 
Dan
-- 
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 25 Oct 2017 - 20:32:13 EDT

This archive was generated by hypermail 2.2.0 : Thu 26 Oct 2017 - 06:45:43 EDT