继续我在过去一个月左右的一系列问题,我又被一件事困住了。就在我认为自己掌握了 RegEx 并且现在可以更好地处理事情时,我遇到了一个新问题。我有相同的文本文件。
快速浏览一下:
================================================
Header of File with time and date
================================================
Loaded options from XML file: '/Thisis/some/Users/sumuser/Desktop/SM_Folder/ESQ/Virtual_Proof_ESQ/processing/ID2PDF_options.xml
extendedPrintPDF started
Postfix '3.0' was append from file 'ESQ030112ELAM_lo-metadata.xml' for file: '/Thisis/some/Users/sumuser/Desktop/SM_Folder/ESQ/Virtual_Proof_ESQ/processing/someFile.indd
printPDF started
PDF Export Preset: Some preset
PDF file created: ''/Thisis/some/Users/sumuser/Desktop/SM_Folder/ESQ/Virtual_Proof_ESQ/processing/someFile.pdf'.
File someFileName.xml removed
postprocessingDocument started
INDD file removed: '/Thisis/some/Users/sumuser/Desktop/SM_Folder/ESQ/Virtual_Proof_ESQ/processing/someFile.indd
================================================
Header of File with time and date
================================================
Loaded options from XML file: ''/Thisis/some/Users/sumuser/Desktop/SM_Folder/COS/Contract_Proof_COS/processing/ID2PDF_options.xml
extendedPrintPDF started
Postfix '8.1' was append from file 'ESQ030112Politics_Russia_lo-metadata.xml' for file: '/Thisis/some/Users/sumuser/Desktop/SM_Folder/COS/Contract_Proof_COS/processing/oneMoreFile.indd
printPDF started
PDF Export Preset: Hearst PDF 1.6_1_16_08
PDF file created: '/Thisis/some/Users/sumuser/Desktop/SM_Folder/COS/Contract_Proof_COS/processing/oneMoreFile.pdf'.
File oneMoreFile.xml removed
postprocessingDocument started
INDD file removed: /Thisis/some/Users/sumuser/Desktop/SM_Folder/COS/Contract_Proof_COS/processing/oneMoreFile.indd
我正在使用以下正则表达式,但它似乎不起作用:
/^Loaded options from XML file: '/Thisis/some/Users/.*/SM_Folder/([a-zA-Z]{3})/Contract_Proof_\1/processing/ID2PDF_options.xml'$/im
给出错误“未知修饰符 T”。
我想从数组中每个条目的第一行捕获 ESQ 和 COS。PS 似乎很容易,但这是问题所在,也可能不是。
1. The username may change. So, I can't create a RegEx relying on username.
2. The COS, ESQ, etc. would repeat further in the entries. But, I only need to catch the FIRST occurrence in each entry.
我可以对我如何做到这一点有任何提示/建议吗?!谢谢