Two days of trial and error and I got something that seems to work:

<(/?)a([^>]*?(?=target|>))( *target="[^"]*" *)?([^>]*)

With my limited understanding of Regular Expressions I believe this 
works as such:

< - match the opening angle bracket '<' character.

(/?) - match an optional forward slash character '/' and put result in 
back reference 1.

a - match the 'a' character.

([^>]*?(?=target|>)) - match the minimum zero or more characters until 
either 'target' or '>' and put result in back reference 2.

( *target="[^"]*" *)? - match an optional 'target="..." with zero or 
more non-double quote characters between the double quotes and put in 
back reference 3.

([^>]*) - match zero or more non-angle bracket characters that maybe 
left after all the above an put into back reference 4.

Do I understand all that correctly and does anybody see if there is any 
way this could be re-factored and simplified?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: http://www.houseoffusion.com/groups/regex/message.cfm/messageid:1215
Subscription: http://www.houseoffusion.com/groups/regex/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21

Reply via email to