Last visit was: It is currently Tue Nov 12, 2024 5:41 am


All times are UTC-05:00




Post new topic Reply to topic  [1 post ] 
    Author Message
     Post subject:Check my regex please :)
    PostPosted:Sun Jan 18, 2009 6:26 pm 
    User avatar
     

    Joined:Sun Feb 12, 2006 8:56 pm
    Posts:1019
    Website:http://eddieringle.com
    Location:Detroit, MI
    I just read a brief tutorial on regex because I need to match hyperlinks for a program I am writing.

    I basically need to match any hyperlink, with any protocol. I've used http://gskinner.com/RegExr/ to play around, and this is what I've come up with:
    Code:
    [A-Za-z0-9]+://[A-Za-z0-9./?=+%;&-]*
    I've made sure that it matches special characters inside links as well. But I just want to post it here to see if anyone has something to add, like a quicker way to match any special character.

    EDIT: Oh yeah, and I suppose to turn a plain text url into a hyperlink I'd use this:
    Code:
    <a href="$&">$&</a>

    _________________
    -- Eddie Ringle

    Check out Elysian Shadows and consider backing us on Kickstarter!

    ====================================

    Image


    Top
    Offline  
    Display posts from previous: Sort by 
    Post new topic Reply to topic

      All times are UTC-05:00


      Who is online

      Users browsing this forum: No registered users and 13 guests


      You cannot post new topics in this forum
      You cannot reply to topics in this forum
      You cannot edit your posts in this forum
      You cannot delete your posts in this forum
      You cannot post attachments in this forum

      Search for:
      Jump to:  
      cron
      Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
      Theme created by Miah with assistance from hyprnova