MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   如何从html标签提取超链接文本? (https://www.labfans.com/bbs/showthread.php?t=22321)

poster 2019-12-01 22:40

如何从html标签提取超链接文本?
 
给定一个包含'blabla [URL="https://www.labfans.com/bbs/admincp/address"]text[/URL] blabla'的字符串,我想从中提取'text' 。
[URL="https://www.mathworks.com/help/matlab/ref/regexp.html"]regexp[/URL] doc建议使用'.*'表达式,但它将提取整个 ... 内容。
当然,我可以像这样继续使用strfind :

line = 'blabla [URL="https://www.labfans.com/bbs/admincp/address"]text[/URL] blabla'; atag = regexp(line,'.*','match', 'once'); from = strfind(atag, '>'); to = strfind(atag, '


所有时间均为北京时间。现在的时间是 21:33

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.