[jQuery] Re: Autolinking Twitter @usernames with jQuery

2008-10-22 Thread Andy Matthews
A simple regex should take care of that for you. Just search for any occurrence of @any number of letters of numbers and wrap the result in an href tag. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Betty B Sent: Wednesday, October 22, 2008

[jQuery] Re: Autolinking Twitter @usernames with jQuery

2008-10-22 Thread Michael Geary
In case it's helpful, here's the code I use in my Twitter election map: http://maps.google.com/help/maps/elections/#twitter function atLinks( str ) { return str.replace( /(^|\s)@([\w_]+)/g, '$1@a target=_blank href=http://twitter.com/$2;$2/a' ); }