SoFunction
Updated on 2025-03-04

Regular expression, extract link address in web page

<td class=cate width="45%" style="word-break:break-all">
<a class=M href="/athena/companydetail/" onMouseDown="return aliclick(this,'?alishop=companylistcompanyname');" target="_blank" class=M>Pengjiang District Fengcai Craft Factory</a>
        <br>

The code is as above. How do I extract "/athena/companydetail/" using regular expressions?
Copy the codeThe code is as follows:

/(http:\/\/\[^" ']+)/gm

/href *= *['"]*(\S+)["']* */gm

Choose according to different needs.