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

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

 채택된 답변

MathWorks Support Team
MathWorks Support Team 2019년 11월 1일

0 개 추천

读取网页可以采用 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, '')

추가 답변 (0개)

카테고리

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!