473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

changing link's target to blank page

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
Jul 21 '05 #1
1 1352
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.
Cesar Garcia H wrote:
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

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Brandon Hoppe | last post by:
I'm trying to change the src of an ilayer in the parent document from a link inside the ilayer. I'm not able to get it to work. All that happens is Netscape 4 crashes. This is for Netscape 4 only....
3
by: Tim Streater | last post by:
I have, as it might be, this in a frame: <a href="mystuff.html">Click here</a> When I click the link, it loads mystuff.html into the frame, whereas what I want is to replace the whole window...
36
by: randau | last post by:
I would like to use the Link Target attribute, but am inhibited by the likelihood of a newly opened browser window completely hiding the Parent browser window. Thus offering the illusion that...
6
by: iwearwatches | last post by:
Group, What a root canal. Here is what I have: I have a page that has several layers that I will either show/hide based on a graphic/tab that the user clicks. (works perfectly)
31
by: Greg Scharlemann | last post by:
Given some recent success on a simple form validation (mainly due to the kind folks in this forum), I've tried to tackle something a bit more difficult. I'm pulling data down from a database and...
0
by: Cesar Garcia H | last post by:
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"...
2
by: Rob | last post by:
Hi Gang: I have a page that loads a remote page into an IFRAME. I don't have any control over this remote page though the page is owned by the same company I work for. The problem is that all...
3
by: Jason | last post by:
Hi, I built a vb.Net application that creates ICS calendar files dynamically and then sends them to the client browser as a downloadable file. Works perfectly except in the following situation....
26
by: Nospam | last post by:
I am trying to open a link in a new template window : <a onclick="windowopen('example.html','example');return false;" href="http://www.example.com" target="_blank"example link</a> such that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.