如何将一个 html 网页读入 MATLAB?同时,希望丢弃所有的 HTML 标签

如何将一个 html 网页读入 MATLAB?同时,希望丢弃所有的 HTML 标签。

 Accepted Answer

读取网页可以采用 webread 函数。对于去除标签,暂时没有直接实现的函数,但这个功能可以通过正则表达式实现,例如:
str = '<HTML>My flowers <b>may</b> <A HREF=''<http://www.a.com'' http://www.a.com''>bloom in</A> May</HTML>';
pat = '<[^>]*>';
regexprep(str, pat, '')

More Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!