Strings,, Broken Links, and Variables --HELP!

Discussion in 'JavaScript' started by dannygoor, Aug 13, 2009.

  1. #1
    Strings,, Broken Links, and Variables --HELP!

    I have a page with over 600 lines of code that I need to fix,
    the problem is as such:

    The page contains about 200 links, the problem is that the link tags are all messed up,, instead of the URL's they all got replaced with xxxxx

    so instead of: <a href="http://mystore.com/product1">product1</a>
    it would read: <a href="http://mystore.com/xxxx">product1</a>

    each product has to link to it's own page .... i.e:

    product1 goes to /mystore.com/product1,,, and so on

    I need help writing a script or performing some sort of function, that will take the text in between the <a></a> tags and insert it into it's own tag instead of the xxxxx

    so it would see <a href="http://mystore.com/xxxx">BaseBall Gloves</a> and convert that line into <a href="http://mystore.com/BaseBall%20Gloves>BaseBall Gloves</a>

    -- OUTPUTS: the ideal way would be if it could replace the existing source (kind of how you can do a find and replace),, if that's not possible, it would need to output all the existing source code with the modified <a> tags to a new window, and then I can copy that code into a new page.

    I've tried using regular expressions and different functions but can't get it to work.

    I really appreciate your help..

    Thanks.
     
    dannygoor, Aug 13, 2009 IP
  2. morehawes

    morehawes Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    PHP's regular expression functions would be perfect for this. Have a look no php.net
     
    morehawes, Sep 11, 2009 IP