Need help finding and changing a string using Coldfusion

bigmikey88
bigmikey88 used Ask the Experts™
on
Hi

Using ColdFusion, what is the easiest way to find links like the one below in a web page, and removing the tag so its no longer a link.

The link text, in this case "top executives" needs to stay.  Just don't want it to be a clickable link.

The key here is that all these links will have both the "XYZ" folder and the ".htm" extension, which makes them unique on the page.

I am slightly familiar with regex, but not good enough to do this on my own.

<a href="/XYZ/management/top-executives.htm"><u>top executives</u></a>

Thx

Michael
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Pawan KumarDatabase Expert
Awarded 2016
Top Expert 2016
Commented:
Try using replace function

REPLACE(yourstring, '.htm' , 'z' )

I am using z , you can use anything. this will the link will be disabled.

Author

Commented:
Hi Pawan,
Thx for helping

The string I am searching for varies so I think I need to use wildcards.  If so does that mean I need an regex?

For example, I only know the beginning and end of the search string:

<a href="/XYZ/     this part varies              .htm">
Most Valuable Expert 2015
Commented:
May want to change the question tags. Since it is really about reg expressions,  tagging it with "Regular Expression" will attract more attention from the regex guru's, not just CF folks.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial