using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?i)\b(Devices|Community String)\b\s*-\s*([\w,\/]+)";
string input = @"1. What is being changed?
Add in Solarwinds monitoring the router and switch of the new Store:
Devices - MCHLS5178,sw517801,sr517800,sr517801,sr517802,MCHLS5184,sw518401,sr518400,sr518401,sr518402
Community String - N/A
2. Where it is being changed?
Solarwinds monitoring (10.3.4.7)
3. Why it is being changed?
To monitor the router and switch of the store 5178,5184
4. What is the Business Impact of the Change?
No business impact during implementation.
5. Who will be doing the change?
Network team
6. When is the change happening?
2020-01-26 01:00:00
7. Who will be testing the change after implementation?
Network team";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
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