Advertisement

09.07.2008 at 09:07AM PDT, ID: 23710266
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.1

Use RegExp to create a link (Use Replace() to create a link)

Asked by Pantyboy in Active Server Pages (ASP)

Tags: ,

Hi Experts.

I'm trying to find a way to take two pieces of information and place them into a <a href...> link using 'Replace()'.

I think an example is needed here to explain.

I want to change: <exLink>"www.anydoman.com","Vist Any Domains website";
to: <a href="http://www.anydomain.com" "target="_blank">Visit Any Domains website</a> inside a Replace() statement.

I have a number of them in use (hence the code) so I would like to incorporate it into the existing framework please.

Many thanks

Martin

I've edited the question title and body in a hope to make what I'm trying to do clearer. Hope it does.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
<%
' Automatically populate link with filename by B_Dorsey at Experts Exchange
' http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_22148871.html?cid=239#18465161
' incorperating a script to find and replace cr/lf with HTML line breaks by b0lsc0tt also at EE
' http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_22127810.html#18343873
' Using Multiple RegExp statements by B_Dorsey at Experts Exchange
' http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/ASP/Q_22396646.html
' If you use this code (or any part of it) please keep this header intact.
' These guys did the work, they deserve the credit. Many thanks.
	
    scr = Request.ServerVariables("SCRIPT_NAME") 
    loc = instrRev(scr,"/") 
    scr = mid(scr, loc+1, len(scr) - loc) 
    'response.write scr
			
	Dim objRegExp
	Set objRegExp = New RegExp
	objRegExp.IgnoreCase = True
	objRegExp.Global = True
	objRegExp.Pattern = "<id=([^>]+)+>" ' Populate Link
	
	sContent = Replace(rsContent.Fields.Item("Content").Value, vbcrlf, "<br />") ' Find & replace
	sContent = objRegExp.Replace(sContent, "<div id=more><a href=" & scr & "?ID=$1 class=more>[ Find out more ]</a></div>")
 
	' Multiple RegExp
	sContent = Replace(sContent,"'","&#39;")
	sContent = Replace(sContent,"£","&#pound;")
	sContent = Replace(sContent,"<charityName>",(rsCharityDetails.Fields.Item("CharityName").Value))
	sContent = Replace(sContent,"<b>","<b class='contentHead'>")
	' End of Multiple RegExp
	
	response.write sContent
	Set objRegExp = Nothing
%>
 
<%
' If a contact name exists write it. Thanks to Rouchie at Experts Exchange
' http://www.experts-exchange.com/Web/WebDevSoftware/DreamWeaver/Q_22124635.html#18331075
 
if (scr = "FamilyServices.asp") Then %>
    <% If rsContent.Fields.Item("PersonnelID").Value <> "" Then %>
        <div id="contactDetailsHeading">Contact Details</div>
		<div id="contactDetails"><%=(rsContent.Fields.Item("Name").Value)%><br />
		<a href="mailto:<%=(rsContent.Fields.Item("EmailAddressName").Value)%><%=(rsContacts.Fields.Item("emailAddressEnder").Value)%>?subject=<%=(rsContent.Fields.Item("SectionContentTitle").Value)%>"><%=(rsContent.Fields.Item("EmailAddressName").Value)%><%=(rsContacts.Fields.Item("emailAddressEnder").Value)%></a><br />
		<%=(rsCharityDetails.Fields.Item("TelephoneNumber").Value)%></div>
	<% End If %>
<% End If %>
 
Loading Advertisement...
 
[+][-]09.08.2008 at 01:31PM PDT, ID: 22421226

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.08.2008 at 01:32PM PDT, ID: 22421232

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.08.2008 at 02:30PM PDT, ID: 22421839

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.09.2008 at 05:36AM PDT, ID: 22426737

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.18.2008 at 01:00PM PDT, ID: 22514771

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.22.2008 at 05:30AM PDT, ID: 22539354

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Active Server Pages (ASP)
Tags: ASP, RegExp
Sign Up Now!
Solution Provided By: L00M
Participating Experts: 1
Solution Grade: A
 
 
[+][-]09.22.2008 at 02:15PM PDT, ID: 22544217

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.23.2008 at 05:37AM PDT, ID: 22548533

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.24.2008 at 02:57AM PDT, ID: 22558150

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906