Pete Freitag Pete Freitag

Auto-Linking Comments

Published on June 24, 2005
By Pete Freitag
coldfusion

To avoid comment spam, my blog comments are displayed as plain text. However urls to other entries on my blog are often posted to in the comments. So I wrote a simple regular expression to create hyperlinks out of them:

REReplaceNoCase(comments.comment, 
	"(http://www\.petefreitag\.com/[^[:space:]]+)",
	"<a href=""\1"">\1</a>", 
	"ALL")

If you want this to work with or without the www you can use something like this for the regular expression:

(http://w*\.?petefreitag\.com/[^[:space:]]+)


regex comments blog rereplace cfml

Auto-Linking Comments was first published on June 24, 2005.

If you like reading about regex, comments, blog, rereplace, or cfml then you might also like:

Fixinator

The Fixinator Code Security Scanner for ColdFusion & CFML is an easy to use security tool that every CF developer can use. It can also easily integrate into CI for automatic scanning on every commit.


Try Fixinator

CFBreak
The weekly newsletter for the CFML Community


Comments

now that's pretty damn useful! thx for post it :)

[OT]

you wouldnt happen to know how they have and can display the content in different languages over at MXNA, would ya?

http://weblogs.macromedia.com/mxna/UserPreferences.cfm
by forgetfoo on 06/24/2005 at 12:17:05 PM UTC
Thanks...

I think the other languages on MXNA are blogs that are actually written in those languages. I could be mistaken perhaps Christain Cantrell or Mike Chambers will read this and can comment further.
by Pete Freitag on 06/24/2005 at 12:46:03 PM UTC
BTW if you find an entry to be useful (or not useful) please use my rating system at the bottom of the post.

Then I can construct which posts are most useful, and which are not.

See http://www.petefreitag.com/about/ for a list of most useful posts so far. (ooh that should auto-link)
by Pete Freitag on 06/24/2005 at 1:24:41 PM UTC
how do you leave comments on all your friends on your friends list on myspace,any help? email me about it
by devon on 10/18/2005 at 3:26:39 PM UTC
hey, i heard there was an auto comment bot, if anyone knows of this bot please let me know [email protected]
by Anthony on 11/05/2005 at 1:06:57 AM UTC
yeah the comment bot what up with it. I know someone has one.
by be dubs on 11/15/2005 at 5:52:17 PM UTC
i would love an email also with that auto post bot info as well.
by zane on 11/18/2005 at 12:15:18 PM UTC