Removing anchor tags from recordset

J

John Smith

How would I strip all <a href=""></a> tags from a block of text using
ASP?

I assume you would need to find "<" and ">" tags, but I am not sure
how you would actually remove it from the text. Any help would be
greatly appreciated!


Thank you!
 
E

Evertjan.

John Smith wrote on 16 mei 2004 in microsoft.public.inetserver.asp.general:
How would I strip all <a href=""></a> tags from a block of text using
ASP?

I assume you would need to find "<" and ">" tags, but I am not sure
how you would actually remove it from the text. Any help would be
greatly appreciated!

Since you do not specify the language,
I take the freedom of using jscript.

Furthermore I suppose you want to keep the tag's innertext:

t = 'zz <a href="blah.com">blah</a> zz'

t = t.replace(/(<a[^>]+>)|(<\/a>)/gi,"")
 
J

John Smith

On 16 May 2004 08:09:06 GMT, "Evertjan."

:John Smith wrote on 16 mei 2004 in microsoft.public.inetserver.asp.general:
:
:> How would I strip all <a href=""></a> tags from a block of text using
:> ASP?
:>
:> I assume you would need to find "<" and ">" tags, but I am not sure
:> how you would actually remove it from the text. Any help would be
:> greatly appreciated!
:>
:
:Since you do not specify the language,
:I take the freedom of using jscript.
:
:Furthermore I suppose you want to keep the tag's innertext:
:
:t = 'zz <a href="blah.com">blah</a> zz'
:
:t = t.replace(/(<a[^>]+>)|(<\/a>)/gi,"")


I should have specified that I am using VBScript. I tried modifying
the code above, but I have little experience with regular expressions
in VBScript.
 
E

Evertjan.

John Smith wrote on 16 mei 2004 in
microsoft.public.inetserver.asp.general:
On 16 May 2004 08:09:06 GMT, "Evertjan."

:John Smith wrote on 16 mei 2004 in
:microsoft.public.inetserver.asp.general:
:
:> How would I strip all <a href=""></a> tags from a block of text
:> using ASP?
:>
:> I assume you would need to find "<" and ">" tags, but I am not sure
:> how you would actually remove it from the text. Any help would be
:> greatly appreciated!
:>
:
:Since you do not specify the language,
:I take the freedom of using jscript.
:
:Furthermore I suppose you want to keep the tag's innertext:
:
:t = 'zz <a href="blah.com">blah</a> zz'
:
:t = t.replace(/(<a[^>]+>)|(<\/a>)/gi,"")


I should have specified that I am using VBScript. I tried modifying
the code above, but I have little experience with regular expressions
in VBScript.


t = "zz <a href='blah.com'>blah</a> zz"

Set regEx = New RegExp
regEx.Pattern = "(<a[^>]+>)|(<\/a>)"
regEx.IgnoreCase = True
regEx.Global = True
t = regEx.Replace(t, "")
 
J

John Smith

On 16 May 2004 15:52:43 GMT, "Evertjan."

:John Smith wrote on 16 mei 2004 in
:microsoft.public.inetserver.asp.general:
:
:> On 16 May 2004 08:09:06 GMT, "Evertjan."
:>
:>:John Smith wrote on 16 mei 2004 in
:>:microsoft.public.inetserver.asp.general:
:>:
:>:> How would I strip all <a href=""></a> tags from a block of text
:>:> using ASP?
:>:>
:>:> I assume you would need to find "<" and ">" tags, but I am not sure
:>:> how you would actually remove it from the text. Any help would be
:>:> greatly appreciated!
:>:>
:>:
:>:Since you do not specify the language,
:>:I take the freedom of using jscript.
:>:
:>:Furthermore I suppose you want to keep the tag's innertext:
:>:
:>:t = 'zz <a href="blah.com">blah</a> zz'
:>:
:>:t = t.replace(/(<a[^>]+>)|(<\/a>)/gi,"")
:>
:>
:> I should have specified that I am using VBScript. I tried modifying
:> the code above, but I have little experience with regular expressions
:> in VBScript.
:
:
:t = "zz <a href='blah.com'>blah</a> zz"
:
:Set regEx = New RegExp
:regEx.Pattern = "(<a[^>]+>)|(<\/a>)"
:regEx.IgnoreCase = True
:regEx.Global = True
:t = regEx.Replace(t, "")


THANK YOU! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top