php preg match all, all the `p`
问题 <?php $str= <<<ETO <p>one two</p> <p>three</p> ETO; preg_match_all('/<p>(.*?)<\/p>/',$str,$r); print_r($r); ?> I am studying preg_match_all . I want get all the p from one article. but my code only get the second p . how to modify so that I can get the first p , either. Thanks. 回答1: You are missing the /ims flag at the end of your regex. Otherwise . will not match line breaks (as in your first paragraph). Actually /s would suffice, but I'm always using all three for simplicity. Also, preg