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


ficgs
More websites

You must register to see these links, as this is a collaborative page, then you may change the order of the links by clicking the icons before the titles.



admin
Other websites

The following links might be less relevant, please change their ranks if you find them useful.


 .htaccess tricks and tips.. part two: url rewriting with mod rewrite.
corz > serv/tricks/htaccess2.php
  1. and later, finding all this information useful in chasing down wonky
  2. @DrunkMunki Regarding your comment to Arun, what should you do
 Gallery2:URL Rewrite - Gallery Codex
codex.gallery2 > Gallery2:URL Rewrite

(optional) Gallery URLs whose parameters are a superset of match are...
can only filter based on request URL parameters, you have access to...

 Free short url redirect Download
wareseeker > free short url redirect

var pageOptions = { 'pubId' : 'pub-8098918000470057', 'channel' :...
- Accounts that are inactive are automatically deleted - Simple...

 URL Rewriting | redirecting URLs with Apache’s mod_rewrite
yourhtmlsource > sitemanagement/urlrewriting

 Learn Regular Expressions, JavaScript RegExp Tutorial, Learn RegExp, Regex Examples, Web-Wise-Wizard
web wise wizard > javascript tutorials/javascript

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

Compose and analyze regex patterns with RegexBuddy's easy-to-grasp...
Page last updated: 17 June 2009 Site last updated: 22 September...

 Create a Short URL Service using PHP & MySQL- PaulSonny
paulsonny > ?p=18

 Java and Regular Expressions - Tutorial
vogella > articles/Java

 ORA_Tweet Now Does Short URLs | Database Geek Blog
database geek > 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 > twitterfox weird behavior

Serving Web Application security community since...

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

45+ Best free PHP classes and libraries for Faster Development |...
45 + Best free PHP classes and libraries for faster development |...

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

TekSavvy and SpeakOut: My Alternatives to Rogers and...

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

How to find a match within another match in a regular...
O'Reilly Answers is a community site for sharing knowledge, asking...
Redeem the reputation points you've earned from participating in...



Response  
 

Guest name   (option)     Register
Please sum : 2935 + seven  




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.