I have the below messages to parse
JavaScript
x
7
1
Messages discarded due to Dispatch Queue cap: 0 / 60001 ms
2
Dispatch Queue size: 2
3
Dispatched Messages: 369 / 60001 ms
4
Dispatched message size: Average: 723, Entries: 39, Min: 366, Max: 1570
5
WinSockDispatcher: 53 / 8865 ms
6
UXDispatcher: 57 / 8865 ms
7
The regex which I have so far is
JavaScript
1
2
1
(Messages discarded.* Dispatch Queue cap|Dispatch Queue size|Dispatched Messages|WinSockDispatcher|UXDispatcher).+ (d.+).+ (d.+)
2
I am able to match almost everything I except the line
Dispatch Queue size: 2
Looks like the last group in my regex should be optional. I tried using ?
but I am unable to figure out the proper syntax.
Can someone please suggest the change that would be help here?
Advertisement
Answer
This should give you the groups:
JavaScript
1
2
1
(Messages discarded.* Dispatch Queue cap|Dispatch Queue size|Dispatched Messages|WinSockDispatcher|UXDispatcher): (d+)(?: / +(d+.*))?
2