Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在制作一个脚本来解析一些报告。在每一页的末尾都有打印日期,格式如下:
Printed on Jun 12, 2012 at 10:04 PM
我想删除该文本,但由于我的正则表达式知识非常基础,我不知道如何继续。它还应该涵盖上午/下午。有任何想法吗?
$text = preg_replace('~Printed on.*?(AM|PM)~', '', $text);
它将删除从“打印在”到上午或下午的所有内容