?
Solved

Replace function with wildcard

Posted on 2005-03-20
6
Medium Priority
?
5,524 Views
Last Modified: 2008-01-09
assumed that:
1. I have a string. Example:

  myString = "I found it at http://www.abc.com/ and www.xyz.com"

2. I need it to display as HTML with clickable hyperlink
3. I need a function that to smart enough to detect the above string contains a hyperlink, and replace it to become

myString = "I found it at <a href='http://www.abc.com/'>http://www.abc.com/</a> and <a href='http://www.xyz.com/'>www.xyz.com</a>"

How do I do that? the vbscript replace() doesn't seems to be able to do this. :(
0
Comment
Question by:calvinfoo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 14

Expert Comment

by:dfu23
ID: 13588341
It sounds like string pattern matching is what you are looking to do ...

Using a Regular Expression (Regex object in VBScript) you can search for what looks like a URL and then format it to show the links. It depends on how you want to go about matching items in the string to best match URLs ... if you need further assistance let us know ...
0
 
LVL 1

Author Comment

by:calvinfoo
ID: 13588375
thanks for showing me the light

appreciate if there are some coding samples in ASP 3.0 :)
0
 
LVL 14

Accepted Solution

by:
dfu23 earned 600 total points
ID: 13588597
RegExp object reference:

http://devguru.com/Technologies/vbscript/quickref/regexp.html

And this article may be useful:

http://www.4guysfromrolla.com/webtech/043001-1.shtml

Shout if more assistance is needed...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:calvinfoo
ID: 13588829
I guess I am pretty much understood the RegEx object, nothing much complicated,

I have problem writing the regular expression here,

I would like to replace anything that starts with http:// or www to become a hyperlink, <a href=''></a> how do I "express" that pattern?  
0
 
LVL 1

Author Comment

by:calvinfoo
ID: 13588881
http://www.4guysfromrolla.com/webtech/tips/t110900-1.shtml

The perfect answer that I am looking for.
0
 

Expert Comment

by:svgharmode
ID: 13588968
Dear Friend,

Try This String in u r ASP Page......


myString = "I found it at <a href=""http://www.abc.com/"">http://www.abc.com/</a> and <a href=""http://www.xyz.com/"">www.xyz.com</a>"

Copy this Statement  And paste in u r code........... it will work definitely.....


Cheers :)
Sannjeev
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question