.*を使います。
$text = "当面の金融政策運営について [PDF 195KB]";
echo preg_replace("/\[PDF.*\]/","", $text);
[PDF 195KB]が非表示となりました。

前)

後)

ディレクトリ配下のファイル名を取得
$y = "2017";
foreach(glob("file/".$y."/{*.txt}",GLOB_BRACE) as $file){
    if(is_file($file)){
        $files[] = htmlspecialchars($file);
    }
}
var_dump($files);
array(8) { [0]=> string(19) “file/2017/boj.0.txt” [1]=> string(19) “file/2017/boj.1.txt” [2]=> string(19) “file/2017/boj.2.txt” [3]=> string(19) “file/2017/boj.3.txt” [4]=> string(19) “file/2017/boj.4.txt” [5]=> string(19) “file/2017/boj.5.txt” [6]=> string(19) “file/2017/boj.6.txt” [7]=> string(19) “file/2017/boj.7.txt” }
しかしforeachでfunction Translateを回すと、 Cannot redeclareとなる。
Cannot redeclare Translate() (previously declared in /home/vagrant/translator/test.php:40) in /home/vagrant/translator/test.php on line 40
これは困った。
 
					 
