Home >Backend Development >PHP Tutorial >Example of PHP regular extraction of image addresses that do not contain the specified URL_PHP Tutorial
But now this article may contain some expressions. Of course we cannot directly extract src Lu Jin, so if the first one is an expression picture, the expression picture will be extracted as the cover. At this time we need to write clearly Regular rules are used to exclude unmatched images. Here is a small example:
$contents = '
Tiredness is a kind of enjoyment, leaving us no time to feel empty; ups and downs are an experience, allowing us to truly understand life;
Being busy is a kind of happiness, leaving us no time to experience pain ;Running around is a joy,
preg_match('#
var_dump($matches);
//Run result
/*
array (size=2)
0 => string ' 1 => string 'http://www.jb51.net/uploads/image /20140420/13979336569926.jpg' (length=66)
*/