[Solved] C# Regex to split string by commas that are only before “or” [closed]


Given your requirement as described:

var output = Regex.Split(input, "(?<!or.*),");

However, given your sample output it seems you want to split on ‘or’ as well:

var output = Regex.Split(input,
                         "((?<!or.*),)|(or)",
                         RegexOptions.ExplicitCapture);

4

solved C# Regex to split string by commas that are only before “or” [closed]