using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?=(.*\n){3}Ethernet Interface)[\w\W]+(?=IfIndex)";
string input = @"Tue Oct 0 00:00:00 UTC 0000
A:REDACTED# REDACTED 7/1/8
==============================================================
Ethernet Interface
===============================================================
Description : REDACTED
Interface : 0/0/0 Oper Speed : 10 Gbps
Link-level : Ethernet Config Speed : N/A
Admin State : up Oper Duplex : full
Oper State : up Config Duplex : N/A
Physical Link : Yes MTU : 2004
Single Fiber Mode : No Min Frame Length : 64 Bytes
IfIndex : REDACTED Hold time up : 90 seconds";
Match m = Regex.Match(input, pattern);
Console.WriteLine("'{0}' found at index {1}", m.Value, m.Index);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx