I have an string that may have several combinations of ANDs and ORs as follow:
string display = "every ((Id2=Event(MachineInfo='M3',UserInfo='U3')) or (Id1=Event(MachineInfo='M2',UserInfo='U2')) and (Id0=Event(MachineInfo='M1',UserInfo='U1')))"
Right now I have an inefficient way to catch just the first MachineInfo and UserInfo but I don't know how to get the rest of the elements of the string:
const string machineinfo = @"MachineInfo='(?<MachineInfo>[^']+)";
const string userinfo = @"UserInfo='(?<UserInfo>[^']+)";
string machineName = display.Contains("MachineInfo") ?
Regex.Matches(display, machineinfo)[0].Groups[1].Value : "ANY";
string userName = display.Contains("UserInfo") ?
Regex.Matches(display, userinfo)[0].Groups[1].Value : "ANY";
What can I do to get all the MachineInfos and UserInfos without knowing the number of ANDs and ORs that I may have in display string??