I have a string:
str = "<img src='http://server/path/a.jpg' />blah blah blah blah";开发者_如何学Go
What would be the regular expression to find the attribute source value?
I do not want to use HTML Agility pack.
Regards,
Don't use regex to parse HTML. Use one of the many available parsers that suits your needs.
But if you really have to, for that sting this simple (and in many cases broken) regex could work for you:
\bsrc\s*=\s*["']([^"'>]+)
Use HTML agility pack; even for small things!
:: sigh ::
精彩评论