I have a string which is a REST query string and it looks like this
//new_requestSet?$select=new_ExternalStatus,new_name&$filter=new_ExternalStatusDirty eq true
I am using a regex class posted here on StackOverFlow. It works well to find some positions in my input string above but I feel like my code to extract the actual values I need is inefficient. Is there a more efficient way using regex instead of IndexOf and SubString?
int fieldPos = StringExtender.NthIndexOf(json, "filter=", 1);
int firstSpace = StringExtender.NthIndexOf(json, " ", 1);
int secondSpace = StringExtender.NthIndexOf(json, " ", 2);
int entityPosEnd = StringExtender.NthIndexOf(json, @"\Set", 1);
int searchFieldStart = StringExtender.NthIndexOf(json, "=", 2);
string searchField = json.Substring(searchFieldStart + 1, firstSpace - searchFieldStart - 1);
string criteria = json.Substring(secondSpace+1);
string entity = json.Substring(0, entityPosEnd);