Regex in HTML

So, I’m trying to write a nice bit of regex to handle finding anchor
tags in
a bit of html.

This is what I’ve got…

/<[aA][^>]>[^<]</[aA]>/

I’m planning on using this with a gsub!.

Here is what it has to do…

Anything in here.

As you can see, the regex I have will indeed work for this instance. It
will
match with ‘Anything in
here.

Except, here is where it fails…

Anything in here.

I still need ‘Anything in here.

This regex doesn’t work…
/<[aA][^>]>.</[aA]>/
Because my middle tag will just keep going and return

Anything in
here.

because it doesn’t have any reason to stop.

Any suggestions?

-hampton.

replace .* with [^(</a)(</A)]

That should work.

-N

You could use the ? non-greedy modifier for this:

/<a.*?</a>/

This will match from the beginning of the <a to the first .

On 4/23/06, Hampton [email protected] wrote:

I still need '<a href=“http://stuff.com


Family management on rails: http://www.famundo.com - coming soon!
My development related blog: http://devblog.famundo.com

WOooooowhoooo!!!

Thanks!