Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在一行中编写一个正则表达式来提取选定的字段:
例如这条线
(2017-11-01 time=14:07:41)
我想写一个正则表达式来提取以下结果:
2017-11-01 14:07:41
换句话说,我想显示一组(2017-11-01 14:07:41)没有“时间=”字符。
你不能用 1 组来做。正则表达式组不能“跳过”字符。
您可以使用 2 组来完成:
\((.*? )time=(.*?)\)
或更简单,在您的语言中使用正则表达式替换:
Search: \((.*? )time=(.*?)\) Replace: $1$2 (or \1\2 depending on your language/tool)