Regular Expressions: Support for Non-Greedy Matching

Ideas for new features

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
lukasbradley
Posts: 5
Joined: Fri Apr 01, 2005 2:11 am

Regular Expressions: Support for Non-Greedy Matching

Post 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.
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post 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"
Hope this was helpful.............good luck,
Bob
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

search for

Code: Select all

alt="[^"]*"
lukasbradley
Posts: 5
Joined: Fri Apr 01, 2005 2:11 am

Post 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.
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

There's a poll out on this, see here.
Then I open up and see
the person fumbling here is me
a different way to be
lukasbradley
Posts: 5
Joined: Fri Apr 01, 2005 2:11 am

Post by lukasbradley »

Excellent. Voted. Thank you.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Have you had a look at Helios's WildEdit (http://www.textpad.com/download/wildedit.html)?
lukasbradley
Posts: 5
Joined: Fri Apr 01, 2005 2:11 am

Post 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:
Post Reply