www.webdeveloper.com
Results 1 to 5 of 5

Thread: Short URL?

  1. #1
    Join Date
    Feb 2003
    Posts
    70

    Short URL?

    Anybody know how this Web site abbreviates/shortens the URL links posted in these threads? I'd like to incorporate this feature into http://www.usedflutes.com and http://www.usedviolins.com for the often very long URL links posted there.

    Many thanks in advance,

    -Bob

  2. #2
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    In general you could do this:
    Code:
    $text =~ s|(<a href="[^"]*?">)(.*?)(</a>)|$1 . (length $2 > 20 ? substr($2, 0, 16) . '...' : $2) . $3|eg;
    Though this method of identifying anchors in HTML is very specific and will not match all valid occurances. You should use HTML::TokeParser for this if possible.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  3. #3
    Join Date
    Feb 2003
    Posts
    70
    Wow! Thanks Jeff. Unfortunately, this is quite a bit "over my head," so I have some homework to do to see if I can figure out how to integrate it into the MySQL script.

    Thanks again Jeff for the help, :-)

    -Bob

  4. #4
    Join Date
    Feb 2003
    Posts
    70
    Hi Jeff,
    OK - I'm not sure how to do this...
    I did read about TokeParser from the link you sent as well as a general search on Google for other users of it ( for example, http://wdvl.internet.com/Authoring/L...okeParser.html ). However, I'm still not clear on how to integrate/modify it into the existing script http://usedflutes.com/MySQL_script.txt ( $val[5] = the URL link ).
    BTW, somebody recently posted a very long URL on http://www.usedflutes.com which is a good example of what I'm trying to abbreviate ( http://search.freefind.com/find.html...te_gal@msn.com )
    It looks like this forum abbreviates URLs formatted as 35 characters -> ... -> 15 characters. Something similar to this would be great.

    Thanks again Jeff for any more help on this you can provide,

    -Bob
    Last edited by bobafifi; 04-02-2003 at 08:16 AM.

  5. #5
    Join Date
    Feb 2003
    Posts
    70
    Got it! :-)

    (see "The Mad Hatter" http://www.perlmonks.org)

    Thanks again,

    -Bob
    Last edited by bobafifi; 04-06-2003 at 12:00 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles