Jump to content

preg_match http problem


greenheart

Recommended Posts

Hello I am using preg_match to find a http address in a string. Here is my code:

 

preg_match_all("#href=\"(http://[^']+)\"#", $string, $matches);          
print_r($matches);	

 

 

Problem is it gives e.g

http://www.example.com/review">

 

followed by images (which are in img tags next to the address in the string)

 

when I want 

 

http://www.example.com/review

 

without the ">. I tried to specify it ends in " but it goes on past the " and onto the next ".

 

Please help me, thank you.

 

 

Link to comment
https://forums.phpfreaks.com/topic/176875-preg_match-http-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.