regex - Regular Expression capturing records PHP 2 -
i'm trying result below, can not, give me idea?
my cod.:
$string ='zamm et est hac pid pid sit amet, lacus nisi zppp scelerisque sagittis montes, porttitor ut arcu zamm tincidunt cursus eu amet nunc zamm c ac nunc, et pid pellentesque amet, zsss m urna scelerisque in vut'; if(preg_match_all("/zamm.*/", $string, $matches)) { foreach($matches[0] $match){ echo $match; echo "<br />"; } }
expected result:
1: zamm et est hac pid pid sit amet, lacus nisi zppp scelerisque sagittis montes, porttitor ut arcu zamm tincidunt cursus eu amet nunc zamm c ac nunc, et pid pellentesque amet, zsss m urna scelerisque in vut 2: zamm tincidunt cursus eu amet nunc zamm c ac nunc, et pid pellentesque amet, zsss m urna scelerisque in vut 3: zamm c ac nunc, et pid pellentesque amet, zsss m urna scelerisque in vut
/zamm(.(?!zamm))*/
take following characters not followed zamm. called negative lookahead.
Comments
Post a Comment