Home >Backend Development >PHP Tutorial >php简单正则问题
<?php$timestamp = '2012年02月03 15:06:46';preg_match_all("/(.*?)年(.*?)/is", $timestamp, $rarr, PREG_SET_ORDER);print_r($rarr);preg_match_all("/(.*?)年(.*?)月(.*?) (.*?):(.*?):(.*?)/is", $timestamp, $rarr, PREG_SET_ORDER);print_r($rarr);?>
$timestamp = '2012年02月03 15:06:46';preg_match_all('/\d+/', $timestamp, $rarr);print_r($rarr);
preg_match_all('/[^年^月^\s^\:]+/', $timestamp, $rarr);
preg_match_all('/[^年^月^\s^\:]+/', $timestamp, $rarr);