Wrap URL within a string with a href tags using Co

2019-02-26 05:46发布

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

2条回答
贪生不怕死
2楼-- · 2019-02-26 06:13

This should work:

<cfset myStr = REReplaceNoCase(myStr, "(\bhttp://[a-z0-9\.\-_:~@##%&/?+=]+)", "<a href=""\1"">\1</a>", "all") />
查看更多
登录 后发表回答