What are the differences between using "<.*img.*>" and ".*img.*" in preg_match_all in PHP?
Using "<.*img.*>" in preg_match_all will match any string that contains the word "img" within HTML tags, such as <img src="image.jpg">. On the other hand, using ".*img.*" will match any string that contains the word "img" without considering HTML tags. Therefore, if you specifically want to match "img" within HTML tags, you should use "<.*img.*>".
// Using "<.*img.*>" to match "img" within HTML tags
$string = '<img src="image.jpg">';
preg_match_all('/<.*img.*>/', $string, $matches);
print_r($matches[0]);