Extrating href values from <a> tags

Results 1 to 2 of 2

Thread: Extrating href values from <a> tags

  1. #1
    Matt Thrower Guest

    Default Extrating href values from <a> tags

    I want to be able to extract the values of href attributes from &#060;a&#062; tags in html and ASP files in order that I can check the validity of their destination. It&#039;s easy enough to create a textstream object that reads all the files and picks out the beginning and end of &#060;a&#062; tags but how can I extract the value of href given that it may or may not contain spaces, &#039; marks or " marks bewteen the href, the = and the attribute value?<BR><BR>I know you could do this with RegExp but I&#039;m not familiar with it. You could probably also do it with InStr() after a lot of rigmarole.

  2. #2
    Join Date
    Dec 1969

    Default Try This...

    dim somestring<BR>somestring="&#060;a href=""http://www.blah.com""&#062;blah&#060;/a&#062;"<BR>pos = instr(1,somestring,"""")<BR>somestring = right(somestring,len(somestring)-pos)<BR>somestring = left(somestring,len(somestring)-(len(somestring)-instr(1,somestring,""""))-1)<BR>response.write(somestring)<BR><BR><BR>-- Whol

Posting Permissions

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