I'm a network engineer working with multiple version of Cisco's IOS and need to use multiple regular expression patterns. Is there a way to build an array of regex patterns?
I've used regex patterns in various other programs, but when I started building this I have 3 pattern formats to search for so far and will be adding more as I go through our network, no doubt.
I've tried the usual:
Regex someVariable[] = new Regex();
This is currently what I have and would like to clean this up into an array for future loop searches through the patterns or so I can just call them individually as needed someVariable[0], etc.
Regex intRegex = new Regex(@"((?<!\S)[A-Za-z]{2}\d{1,5}\S+\s+)|(\s[A-Za-z]{7,15}\d{1,5}\S+\s+)", RegexOptions.Compiled);
Regex psRegex = new Regex(@", id\s+\d{10},", RegexOptions.Compiled);
Regex cidRegex = new Regex(@"\d{3}-\d{3}-\d{4}", RegexOptions.Compiled);
Regex vcidRegex = new Regex(@"vcid\s\d{10},", RegexOptions.Compiled);
I'm not sure what my options are with c# as I've never walked down this path with c# before and in the past have only ever used 1 or maybe 2 Regex search patterns in an entire program before.