changing link's target to blank page

  • Thread starter Thread starter Cesar Garcia H
  • Start date Start date
C

Cesar Garcia H

Hi everybody...

I'm making an application that receives HTML and before showing it has
to format it in some way that all links that are inside that HTML must
have target attribute with "_blank" value... so, to do this I need a
regular expression that matches this :

<a href="http://www.abc.com/"> OR
<a href="http://www.abc.com/" target="somevalue">

but, doesnt match this

<a href="http://www.abc.com/" target="_blank">

Been more specific, I need a regular expression that matches a link
without target attribute, or with a target value different of "_blank"

Some ideas??

I tried googling... but... I didnt found anything.

Thanks in advance

Cesar Garcia H.
http://www.zapcome.com/zapblog/cesargarcia
 
It might be easier to make it a 2 step process. Make a regular
expression that finds links (should be able to find one at regexlib or
other internet repository). Then with each result, run another regex
(or just use the IndexOf() method) to see if it contains a target attribute.
 
Back
Top