フィルターのクリア

How to Separte table data from html?

1 回表示 (過去 30 日間)
Bilal qureshi
Bilal qureshi 2018 年 6 月 6 日
編集済み: Paolo 2018 年 6 月 6 日
i am doing web reading using Http POST method with urlread function. how to separate html Table data from html?(str)
ur='https://www.w3schools.com/html/html_tables.asp';
str=urlread(ur)

採用された回答

Paolo
Paolo 2018 年 6 月 6 日
編集済み: Paolo 2018 年 6 月 6 日
You should be using webread rather than urlread as stated in the documentation. You can use regexp to extract HTML elements from a HTML document. There are examples on how to do so on the regexp documentation page.
Use the following code to extract < table > elements.
ur = 'https://www.w3schools.com/html/html_tables.asp';
str = webread(ur);
%Using urlread instead will give the same output.
%str = urlread(ur);
expression = '<(table).*?</\1>';
matches = regexp(str,expression,'match');
matches contains the two < table > elements in the HTML.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by