Match the smallest number of characters starting with "p" and ending with "t" : Regular Expressions « String « PHP
- PHP
- String
- Regular Expressions
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";
}
?>
Related examples in the same category