SEO Forums















                                          
User   Password   remember     (register)  ?

Regular expression to shorten URL


Back to website development.


moderator    (2006-12-18)

moderator

Regular expression to shorten URL

Hello to all...

I have a small code problem, looking for a regular expression that would shorten URL changed in links (ie. ht*p://www.ficgs.com/looooooooooooongurl.html would appear ht*p://www.ficgs.com/looo...url.html .. Here is my regular expression :

$url = preg_replace("#([\n ])?([hftp]+)://([a-z0-9-=_%\#$~%&;?./]+)#i", '\1<a href="\2://\3" target="_blank">\2://\3</a>', $url);


Thanks in advance :)


ficgs
Suggestions

 .htaccess tricks and tips.. part two: url rewriting with mod rewrite.
corz.org/serv/tricks/htaccess2.php

 Gallery2:URL Rewrite - Gallery Codex
codex.gallery2.org/Gallery2:URL_Rewrite

 Free short url redirect Download
wareseeker.com/free-short-url-redirect/



ficgs
More suggestions

This is a collaborative page, you may change the order of these suggestions by registering, then clicking the icons before the titles.


 URL Rewriting | redirecting URLs with Apache’s mod_rewrite
www.yourhtmlsource.com/sitemanagement/urlrewriting.html

 Learn Regular Expressions, JavaScript RegExp Tutorial, Learn RegExp, Regex Examples, Web-Wise-Wizard
www.web-wise-wizard.com/javascript-tutorials/javascript-regular-expressions

 Regular-Expressions.info - Regex Tutorial, Examples and Reference - Regexp Patterns
www.regular-expressions.info/

  Create a Short URL Service using PHP & MySQL- PaulSonny
www.paulsonny.com/?p=18

 Java and Regular Expressions - Tutorial
www.vogella.de/articles/JavaRegularExpressions/article.html

 ORA_Tweet Now Does Short URLs | Database Geek Blog
database-geek.com/2009/04/11/ora_tweet-now-does-short-urls/

 Twitterfox weird behavior – Auto Extract short URL ? How to disable? | N-Stalker Web Security Community
community.nstalker.com/twitterfox-weird-behavior

 PHP Class Create Short URL via TinyURL, Is.gd, Hex.io, Tr.im & Bit.ly API
www.chazzuka.com/blog/?p=193

 Host Your Own URL Shortener: 10 PHP Apps Reviewed « Eric Severance
esev.com/blog/review/host-your-own-url-shortener-10-php-apps-reviewed/

 How to validate URLs with regular expressions - O'Reilly Answers
answers.oreilly.com/topic/280-how-to-validate-urls-with-regular-expressions



Response  
  Smilies

Guest name   (optional)       Register for more options.



Trackbacks : If you talked about this article in your blog or website, you may instantly get a backlink 
  There's no trackback at the moment.









 

FICGS message




SEO forums and chat - Search engines optimization



 
Please download Flash player.
March 15, 2010

 

Buttons: Facebook, Twitter, MySpace, Google, Technorati, Yahoo buzz... Ficgs Facebook Myspace Twitter Google Technorati Stumble upon Delicious Digg Yahoo buzz Wikio Furl Reddit Linkedin Squidoo Newsvine Yahoo My Web Blogmarks Comments Blinklist Email

You comment I follow : Links included in comments will be "dofollow" if your post is not an obvious spam, comments are published instantly.


Write upside down to your contacts !
(works with Facebook, Twitter, MSN, Yahoo, MySpace, Hi5, Bebo, Youtube...)







FICGS is also a Free Internet Correspondence Games Server.

Here you can play Chess, Go & Poker Texas Holdem online for free in rated class tournaments and a unique world championship.

Free Internet Chess & Go Server


Feel free to link to FICGS :