继续在字符串匹配后从文本文件中获取文件名 - PHP 我有一个格式为 log.txt 的文件:
================================================
Header of entry with date and time
================================================
Loaded options from XML file: '/path/to/the/file/some_file.xml
extendedPrintPDF started
Postfix '4.4' was append from file 'some-other_file.xml' for file: /path/to/the/file/some-other_file.indd
printPDF started
PDF Export Preset: Some preset
PDF file created: '/path/to/the/file/some_filey_namex_lo_4.4.pdf'.
File filename_lo-metadata.xml removed
postprocessingDocument started
INDD file removed: /path/to/the/file/some_file1_name_lo.indd
Error opening document: /path/to/the/file/some_file_name_lo.indd: Error: Either the file does not exist, you do not have permission, or the file may be in use by another application; line: 190
================================================
Header of entry with date and time
================================================
Loaded options from XML file: '/path/to/she/file/some_options.xml
extendedPrintPDF started
extendedPrintPDF: Error: Unsaved documents have no full name.; line: 332
我想为日志条目捕获单词“错误”(如果存在),然后检测错误消息(如“未保存的文档没有全名”)或只是“打开文档时出错”,并获取所有且仅的名称正在创建的 pdf 文件。
我是一个新手,真的不知道我应该如何去做。
我想我已经提供了完整的信息,而我在之前的帖子中没有做到这一点。
更改:我还想从 /path/to/the/file/filename.something 中获取“the”。我不是在寻找一个确切的答案(即使它会很棒)。但是,我们将不胜感激一些帮助或指导。
注意:有没有办法在不使用 RegEx 的情况下做到这一点(我是新手,而且我一点也不擅长 RegEx)谢谢