David Green David Green - 1 year ago 70
C# Question

Need RegEx Pattern To Match '--'

Here's some input

36 1 36 0ef6c0 id N8 Online FC F-Port 50:05:07:68:01:80:fc:ae
37 1 37 0ef680 id N8 Online FC F-Port 50:05:07:68:01:80:fa:1b
38 1 38 0ef640 id N8 Online FC F-Port 50:05:07:68:01:80:fa:2e
39 1 39 0ef600 id N8 Online FC F-Port 50:05:07:68:01:80:f9:ca
86 2 22 0eea40 -- -- Online VE VE-Port 10:00:00:05:33:ea:da:4d "replsa2v" (downstream)
87 2 23 0eea00 -- -- Offline VE Disabled (Persistent)
88 2 24 0ee9c0 -- -- Offline VE Disabled (Persistent)

This regular expression matches the first 4 lines.


This one matches the last 3


I'd like one pattern that matches all. The code works but it would be cleaner and slightly faster if I was doing a single match. The best I can do with a single pattern is to match the first half of the first 4 lines of input and the last half of the last 3 - basically everything before the first '--' and after the last one.

Answer Source

this work for me:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download