【发布时间】:2023-01-10 10:07:51
【问题描述】:
我想将此消息分成几组:
[Rule] 'Server - update repository' [Source] 10.10.10.10 [User] _Server [Content] HTTP GET http://example.com
预期结果:
Group1: [Rule] 'Server - update repository'
Group2: [Source] 10.10.10.10
Group3: [User] _Server
Group4: [Content] HTTP GET http://example.com
不一定是4组,有时可以少/多。 我尝试构建的模式:
(\(^\[\w+\].*\)){0,}
【问题讨论】:
标签: regex ruby regex-group