我有这样的代码:
include('class.pdf2text.php');
$a = new PDF2Text();
$a->setFilename('557270281.pdf');
$a->decodePDF();
preg_match('/[0-9]{2}\/[0-9]{2}\/[0-9]{4}/', $a->output(), $date);
print_r($date);
preg_match('/bre(.*?)Pro/', $a->output(), $nombre);
print_r($nombre);我可以提取$date,但不能提取$nombre,因为它得到的结果为空。我在http://gskinner.com/RegExr/的代码中测试了第二个正则表达式,它可以工作。
如果我将这个添加到我的代码中,
$n ="Nombre : john smith angola Provincia : MADRID ";然后将代码中的第二个正则表达式更改为,
preg_match('/bre(.*?)Pro/', $n, $nombre);它起作用了。
如何从$a->output()中提取它?
发布于 2013-03-07 05:08:18
Tfe /s modifier是为了让.匹配换行符:
preg_match('/bre(.*?)Pro/s', $a->output(), $nombre);https://stackoverflow.com/questions/15257685
复制相似问题