$str = "<p>This is one</p><p>This is two</p><p>This is three</p>"; $pattern="/(<p[^>]*>(.*)</p>){2}/isU"; preg_match($pattern,$str,$matches); echo htmlentities($matches[0]);