J
jumblesale
Hello all,
I'm not all that bad at Regex, but i'm stumped on how to approach my
problem.
I need to parse a string and remove all html tags except hyperlinks.
I can remove all the html tags using: Regex.Replace(inputText,
@"<(/?[^\>]+)>", "");
But this also removes any hyperlinks, which i need to keep.
I've also written a regex for finding hyperlinks:
<a[\s]href=["'][^"]+[.\s]*["'][^<]+[.\s]*</a>
but my problem is trying to put all this together.
I've thought of using Regex.Matches and checking each instance but
can't get that to work.
Any ideas and/ or code would be great - i'm used to C# but VB's cool as
well.
Cheers in advance,
max
I'm not all that bad at Regex, but i'm stumped on how to approach my
problem.
I need to parse a string and remove all html tags except hyperlinks.
I can remove all the html tags using: Regex.Replace(inputText,
@"<(/?[^\>]+)>", "");
But this also removes any hyperlinks, which i need to keep.
I've also written a regex for finding hyperlinks:
<a[\s]href=["'][^"]+[.\s]*["'][^<]+[.\s]*</a>
but my problem is trying to put all this together.
I've thought of using Regex.Matches and checking each instance but
can't get that to work.
Any ideas and/ or code would be great - i'm used to C# but VB's cool as
well.
Cheers in advance,
max