Not yet rated

Problem

Transform texts with @Adobe (or any other) to Twitter links.

Solution

Use regular expressions...

Detailed explanation

<cfset t = "Hi, @Adobe" />
<cfset t = REReplace(t, '[@]+([A-Za-z0-9-_]+)','<a href="http://twitter.com/\1" rel="nofollow">@\1</a>','ALL') />


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes