E.g:文件夾名稱的命名模式:正則表達式進行文件夾的特殊名稱模式在PHP
開頭一個字母和三個或十號結束。
F3445656
A543545
F454534535
我的正則表達式爲:
$path = realpath('k:\\folder\\');
$folders = new DirectoryIterator($path);
foreach($folders as $folder){
if($folder->isDot()) continue;
if ($folder->isDir() && preg_match('/[A-Z][0-9]{1,9}$/', $folders)){
echo $folder;
}
那麼,是不是做正確的方式?
非常感謝!
我想你的意思'[0-9] {3,10}'? – Kobi 2011-03-15 05:59:56