How can I get a Hyperlink url ?

9 Ansichten (letzte 30 Tage)
Didier
Didier am 23 Sep. 2015
Verschoben: Dyuman Joshi am 21 Nov. 2023
when I get an html page as a string with urlread (e.g. 'http://www.mathworks.com/index.html?s_tid=gn_loc_drop'), I can see the line '<li class="topnav_products ">Products</li>' and >Products< is a hyperlink to 'http://www.mathworks.com/products/'. Is it possible to get the hyperlink adress, here 'http://www.mathworks.com/products/' ?
Many thanks for your help
Didier

Akzeptierte Antwort

Dasharath Gulvady
Dasharath Gulvady am 28 Sep. 2015
Didier,
The function "urlread" returns a string containing the entire text of the webpage at the specified URL. You may then use regular expressions to extract hyperlinks from this text.
html = urlread(url);
hyperlinks = regexprep(html,'<a.*?/a>','');
The below MATLAB Answers post gives a sample example for the same:
  1 Kommentar
Didier
Didier am 28 Sep. 2015
Verschoben: Dyuman Joshi am 21 Nov. 2023
Hi Dasharath, Many thanks !!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by