PHP preg_match image between html tags
        Posted  
        
            by 
                Alvins
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Alvins
        
        
        
        Published on 2012-12-18T16:57:04Z
        Indexed on 
            2012/12/18
            17:03 UTC
        
        
        Read the original article
        Hit count: 189
        
I've got an html template like this:
    <div class="cont">
    <div class="...">
    <p>...<p>
    <img alt="" class="popup" src="DESIRED IMAGE LINK" style="..." /></p><p>...</p>
    ....
And i want to extract "DESIRED IMAGE LINK" inside the "" tag, currently i'm using this:
$pattern = '<div class="cont">.*?src=["\']?([^"\']?.*?(png|jpg|jpeg|gif))["\']?/i';
if (preg_match($pattern, $content, $image))
     .....
But it doesn't work, the error is:
    warning: preg_match() [function.preg-match]: Unknown modifier '.' 
How can i fix it? Thanks
© Stack Overflow or respective owner