【发布时间】:2018-06-14 13:12:44
【问题描述】:
我正在使用 Fluentd 解析这一行:
info=myinfo,details are included here;proc=/usr/;
我的解析器就是这个:
(?:info=(?<info>[^,]*))[^\;]+(?:\;)(?:proc=(?<process>[^\;]*))(?:\;)
这适用于匹配“详细信息”字段中的任何内容,但是,如果详细信息不包含“身份验证”一词,现在我只想匹配该行。
我尝试过使用正则表达式前瞻方法,例如:
(?:info=(?<info>[^,]*))^((?!Authentication).)*(?:\;)(?:proc=(?<process>
[^\;]*))(?:\;)
(?:info=(?<info>[^,]*))^(?!Authentication).*(?:\;)(?:proc=(?<process>
[^\;]*))(?:\;)
但它不起作用。知道怎么做吗?
谢谢。
【问题讨论】:
标签: regex parsing regex-negation fluentd