フィルターのクリア

Extract hyperlink from data retrieved through urlread()

11 ビュー (過去 30 日間)
Graeme MacKenzie
Graeme MacKenzie 2016 年 6 月 14 日
コメント済み: Graeme MacKenzie 2016 年 6 月 20 日
I am trying to extract urls listed on a website using urlread. urlread gives me the page's content and regexprep allows me to isolate the content I'm interested in (shown in the command window) but I can't seem to extract the url contained in the hyperlink. urlread apparently doesn't return hyperlinks and yet when I hover over the hyperlink in the command window I can find the address I'm looking for (highlighted in yellow in the lower left corner of the image). Any way to extract the url in the hyperlink?

採用された回答

Julian
Julian 2016 年 6 月 17 日
By default hyperlinks are rendered in the command window. You already have the underlying text that you want in your variable but you have to hover over the hyperlink to see it in the command window. The variable editor will show the underlying HTML. So you should easily be able to extract the URLs with something like
hyperlinks = regexp(html,'<a.*?/a>','match');
I have often though that it would be really useful to have something like "Copy Link Address" available on a right click in the command window (particularly to extract matlab: hyperlinks).. What do you think?

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by