[英]Regular expression to extract a string starts at '=' ends at '\t'
I have a log file with data 我有一个包含数据的日志文件
AgentDevice=WindowsLog
AgentLogFile=Security
PluginVersion=7.2.3.2015120
Message=A privileged service was called.
The groups are separated using tabs. 使用标签将组分开。 So I need to cut the data starting at
=
and ending \\t
所以我需要削减从
=
到\\t
I tried this one PluginVersion=([\\w.]*)\\w
but it cuts the last symbol and in addition doesn't work with data like this: 我尝试了一个
PluginVersion=([\\w.]*)\\w
但是它剪切了最后一个符号,此外,它不适用于这样的数据:
Message=A privileged service was called.
Any Ideas? 有任何想法吗?
You can use: 您可以使用:
PluginVersion=([^\t]*)
That is a negative character class. 那是一个消极的角色类别。 It will match all the non
\\t
, effectively up to the next \\t
or the end if there are no more \\t
它将匹配所有非
\\t
,有效地匹配到下一个\\t
,如果没有更多\\t
,则匹配末尾
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.