Extract hyperlink from data retrieved through urlread()

9 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by