I have 2 different types of connection strings (because of legacy reasons that I can't fix everywhere for various reasons which are irrelevant here). I need to break them up into key/value pairs. Here are the sample connection strings:
1. Server=SomeServer;Database=SomeDatabase;Something=Hello
2. Server=SomeServer,Database=SomeDatabase;Something=Hello
3. Server=SomeServer,1111;Database=SomeDatabase;Something=Hello
For the first 2 cases, I can use the regex:
(?<Key>[0-9A-z\s]+)=(?<Val>[0-9A-z\s,]+?[0-9A-z\s]+)
For the third one, I can use the regex:
(?<Key>[0-9A-z\s]+)=(?<Val>[0-9A-z\s]+?[0-9A-z\s,]+)
How do I turn this into one regex that would work for all cases?