I am having a html string (Don't have any kind of file and don't want to first save my string as a html file then load it) and I want to get some link and text between certain tags. I tried to search but did't find any luck. Could someone help me to solve this issue. Thanks in advance.
Well, I don't know the tools well enough, so let's do it manually; first, let's kick off unwanted carriage returns :
myChain = Replace(myChain, Chr(13), "")
myChain = Replace(myChain, Chr(10), "")
Now, let's find the first occurence of the tag :
beginLink = Instr(1, myChain, "<mytag>") + Len("<mytag>")
endLink = Instr(1, myChain, "</mytag>")
lenLink = endLink - beginLink
myLink = Mid(myChain, beginLink, lenLink)
And if You need to look for a subsequent occurence of the same tag, replace the 1 by the end of the previous tags
newPosition = endLink + Len("<mytag>")
beginLink = Instr(newPosition , myChain, "<mytag>") + Len("<mytag>")
endLink = Instr(newPosition , myChain, "</mytag>")
etc...
I leave you to do a proper loop there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With