I trying to write – with no luck – the regex able to extract filter criteria from a string like:
String rawFilter = "field1: something field3: something else field2: any number of words";
Fields can come in any order, and I need to extract some kind of key-value pair list.
Update, as requested in comment. For what I know of regex, the first output could be an array with field names at even positions and value at odd positions. So that:
Console.WriteLine(matches[0]); //Prints field1
Console.WriteLine(matches[1]); //Prints something
Console.WriteLine(matches[2]); //Prints field3
Console.WriteLine(matches[3]); //Prints something else
Console.WriteLine(matches[4]); //Prints field2
Console.WriteLine(matches[5]); //Prints any number of words
Fieldname is in group 1 and the value is in group 2:
prints: