Mega Code Archive

 
Categories / Php / Strings
 

Find the first p string and match as many characters as possible until the last possible t is reached

<? $text = "pot post pat patent"; if (preg_match ( "/p.*t/", $text, $array ) ) {   print "<pre>\n";   print_r( $array );   print "</pre>\n"; } ?>