Preg_match_all not stopping where it should be Preg_match_all not stopping where it should be curl curl

Preg_match_all not stopping where it should be


run the regular expression in U-ngready mode

preg_match_all('#<cite>(.+)</cite>#siU


As in Darhazer's answer you can turn on ungreedy mode for the whole regex using the U pattern modifier, or just make the pattern itself ungreedy (or lazy) by following it with a ?:

preg_match_all('#<cite>(.+?)</cite>#si', ...