Page 1 of 1

Regular Expressions: Support for Non-Greedy Matching

Posted: Fri Apr 01, 2005 2:19 am
by lukasbradley
I would love support for non-greedy matching using Textpad. A great link is here:

http://www.regular-expressions.info/repeat.html

Basically, If I attempt to match everything in an alt tag such as...

Code: Select all

<img alt="This is the text inside" src="hooplah.png" />
And I attempt to use....

Code: Select all

alt=".*"
The following will be matched...

Code: Select all

alt="This is the text inside" src="hooplah.png"
But all I really want is....

Code: Select all

alt="This is the text inside"
So the answer is this....

Code: Select all

alt=".*?"
Which Textpad doesn't currently support. So I would fantastically love it if it did.

Thank you.

Posted: Fri Apr 01, 2005 3:32 am
by Bob Hansen
Using POSIX

Search for:
<img (alt=".*") src=.*

Replace with:
\1

-------------------------------------

This:
<img alt="This is the text inside" src="hooplah.png" />

Becomes this:
alt="This is the text inside"

Posted: Fri Apr 01, 2005 10:36 am
by MudGuard
search for

Code: Select all

alt="[^"]*"

Posted: Fri Apr 01, 2005 2:02 pm
by lukasbradley
Yes, there are ALWAYS solutions to SPECIFIC problems. I'm looking for non-greedy qualifiers, not answers to a specific issue.

Thank you for trying to help, however.

Posted: Fri Apr 01, 2005 4:03 pm
by s_reynisson
There's a poll out on this, see here.

Posted: Fri Apr 01, 2005 4:15 pm
by lukasbradley
Excellent. Voted. Thank you.

Posted: Fri Apr 01, 2005 7:03 pm
by ben_josephs
Have you had a look at Helios's WildEdit (http://www.textpad.com/download/wildedit.html)?

Posted: Fri Apr 01, 2005 7:07 pm
by lukasbradley
FANTASTIC! It looks like the code is already written!

So there will be no problem porting this over to TextPad, so I won't have to buy another set of licenses for a new product, right?!

:lol: