我需要RegEx命令来获取所有没有包含“filewatch”的作业名称的行。任何帮助将不胜感激!感谢。
STATUS: FAILURE JOB: i3-imds-dcp-pd-bo1-05-ftpfilewatcher
STATUS: FAILURE JOB: i3-cur-atmrec-pd-TD_FTP_Forecast_File_Del_M_Su
ALARM: JOBFAILURE JOB: i3-cur-atmrec-pd-TD_FTP_Forecast_File_Del_M_Su
STATUS: FAILURE JOB: i3-sss-system-heartbeat
ALARM: JOBFAILURE JOB: i3-sss-system-heartbeat
STATUS: FAILURE JOB: i3-chq-cspo-pd-batch-daily-renametable-fileok
STATUS: FAILURE JOB: i3-chq-cspo-pd-batch-daily-renametable-file
ALARM: JOBFAILURE JOB: i3-chq-cspo-pd-batch-daily-renametable-fileok
ALARM: JOBFAILURE JOB: i3-chq-cspo-pd-batch-daily-renametable-file
STATUS: FAILURE JOB: i3-imds-dcp-pd-bo1-35-filewatcher
STATUS: FAILURE JOB: i3-imds-dcp-pd-bo1-05-ftpfilewatcher
STATUS: FAILURE JOB: i3-imds-dcp-pd-bo1-35-filewatcher
STATUS: FAILURE JOB: i3-imds-dcp-pd-bo1-05-ftpfilewatcher
答案 0 :(得分:3)
如果您的正则表达式实现支持look-ahead assertions,请尝试以下操作:
^(STATUS|ALARM): +(JOB)?FAILURE +JOB: ((?!filewatch).)+$
确保^
和$
符合文件 行开始/结束。
答案 1 :(得分:0)
Gumbo是正确的。这里有一个参考,向您展示如何在将来做这些事情。 http://www.regular-expressions.info/completelines.html