使用Coldfusion在带有href标记的字符串中包装URL [英] Wrap URL within a string with a href tags using Coldfusion
本文介绍了使用Coldfusion在带有href标记的字符串中包装URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Coldfusion网站,正在拉入包含网址的Feed。我有一些控制的urls,所以我知道他们将始终以http://开头。我想将这些网址包装在href标记,所以他们可以点击,但我有麻烦把它搞清楚。任何你可以给我的信息将是惊人的。
I have a Coldfusion site that is pulling in a feed that contains urls. I have some control over the urls so I know they will always start with http://. I want to wrap those urls in a href tags so they are clickable but I'm having trouble figuring it out. Any info you guys could give me would be amazing.
Eric
推荐答案
b
$ b
This should work:
<cfset myStr = REReplaceNoCase(myStr, "(\bhttp://[a-z0-9\.\-_:~@##%&/?+=]+)", "<a href=""\1"">\1</a>", "all") />
这篇关于使用Coldfusion在带有href标记的字符串中包装URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文