Reputation: 11002
I want to find all img tags in a string of text and put a surrounding link - a tag around it. What's the best way to do it? And I want to retrieve the src link and put in the href attribute.
By the way I'm doing it in C# but the way should be similar in every language. Has anybody done such filtering and replacing? Any advice would be appreciated.
Upvotes: 2
Views: 5268
Reputation: 116987
If you're parsing and dealing with raw HTML strings, I would highly recommend using the Html Agility Pack library.
Upvotes: 2
Reputation: 6302
How do you parse an HTML string for image tags to get at the SRC information?
Upvotes: 2