-
Website
http://blog.andreaolivato.net/ -
Original page
http://blog.andreaolivato.net/programming/using-regular-expressions-to-add-links-to-tweets.html -
Subscribe
All Comments -
Community
-
Top Commenters
-
Tristan Antipyrine
1 comment · 1 points
-
orta
1 comment · 2 points
-
malappuraminfo
1 comment · 1 points
-
torh
1 comment · 1 points
-
Andy Feliciotti
1 comment · 6 points
-
-
Popular Threads
-
Create your first API set in PHP
2 weeks ago · 2 comments
-
Create your first API set in PHP
Here's a javascript equivalent function, based on your tutorial :)
function twitterAddLinks(text)
{
return text.replace( /http([s]?):\/\/([^\ \)$]*)/,
'http$1://$2')
.replace(/@([a-zA-Z0-9_]*)/,
'@$1')
.replace(/\#([a-zA-Z0-9_]*)/,
'\#$1');
}
function twitterAddLinks(text)
{
return text.replace( /http([s]?):\/\/([^\ \)$]*)/g,
'http$1://$2')
.replace(/@([a-zA-Z0-9_]*)/g,
'@$1')
.replace(/\#([a-zA-Z0-9_]*)/g,
'\#$1');
}
[ e dato che siamo entrambi italiani te lo dico anche in italiano: GRAZIE A TE ;p ]