简体   繁体   中英

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

I tried this one PluginVersion=([\\w.]*)\\w but it cuts the last symbol and in addition doesn't work with data like this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM