简体   繁体   中英

preg_match and regular expressions

I am trying to get website adresses from a webpage. The pattern is always:

    <br />i <a href="http://www.website.com"

The part I need is www.website.com. After reading a lot I made this;

    "preg_match('@^(?:<br />i <a href="http://)?([^/]+)@i' , $html, $matches);"

but I think I made a mistake... Someone who can help me ?

I've put my "solution" between brackets because stackoverflow makes a mess of it...

尝试这个:

preg_match( '/<br \/>i <a href="http:\/\/([^"]+)"/', $html, $matches );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM