I have a list of words and corresponding links eg. 

dog www.bigdog.com 

cat www.nicecat.com 

fox www.fox.com 

Can I have one regular expression that will replace all the words on the left 
hand side of the list (ie. dog, cat, fox) with the left hand side 
(www.bigdog.com, www.nicecat.com, www.fox.com)? 

Lets take an input string: 

The dog saw the cat and fox laughing. 

I want the output to be: 

The <a href="http://www.bigdog.com";>dog</a> saw the <a 
href="http://www.nicecat.com";>cat</a> and <a href="http://www.fox.com";>fox</a> 
laughing. 

I will take the word/link list as xml eg; 

<masterlist> 
   <keyword> 
      <text>dog</text> 
      <url>http://www.bigdog.com</url> 
   </keyword> 
   <keyword> 
      <text>cat</text> 
      <url>http://www.nicecat.com</url> 
   </keyword> 
   <keyword> 
      <text>fox</text> 
      <url>http://www.fox.com</url> 
   </keyword> 
</masterlist> 

I am also using msxsl c# script for the reular expression. 
At the moment I am using a recursive function to replace the the contents of 
text node with url node. However the problem is that the longer the list gets 
the longer it takes for all the text to get replaced. I would really like to 
have an expression that will replace a group of text with a group of urls, in 
one go. 

Can this be done? 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1001
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21

Reply via email to