Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 15th, 2004, 08:49 AM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Generate links

I need asp script for this:

I have a text in a database. I wrote the text with the response.write object and i want to check some words (ex. rar, excel) in the text and these words will be underlined and will be a link to some page.

Thank you

 
Old October 15th, 2004, 09:18 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

IMO, Regular expressions are the best for you. Here is a sample code.

Dim objRegExp
Set objRegExp=Server.CreateObject("VBScript.RegExp")
objRegExp.IgnoreCase=true
objRegExp.Global=True
objRegExp.Pattern="\brar\b" ' matches the complete word rar
Response.Write(objRegExp.Replace(strYourString, "<a href=""http://www.link.com"">rar</a>"))
----------------------------------------------------------------------
strYourString is the string taken from db (the one in which the word rar is to be replaced).

PS: The above code is intended to give you a guideline. It is not tested.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Links that disappear Surre ASP.NET 1.0 and 1.1 Professional 8 February 2nd, 2007 11:15 AM
AutoSuggest and Links gt96 BOOK: Professional Ajax ISBN: 978-0-471-77778-6 1 July 4th, 2006 04:58 PM
Only some images must have links brettdalldorf ASP.NET 1.0 and 1.1 Basics 0 August 7th, 2005 08:49 AM
XSLT for links bmains XSLT 5 February 10th, 2005 08:38 AM
Sub links problem hlchuah77 CSS Cascading Style Sheets 3 February 2nd, 2005 02:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.