Mega Code Archive

 
Categories / Php / Strings
 

Match the smallest number of characters starting with p and ending with t

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