RESTクエリ文字列である文字列があり、次のようになります
//new_requestSet?$select=new_ExternalStatus,new_name&$filter=new_ExternalStatusDirty eq true
StackOverFlowに投稿された正規表現クラスを使用しています。上記の入力文字列でいくつかの位置を見つけることはうまくいきますが、必要な実際の値を抽出するためのコードは非効率的だと感じています。IndexOfと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);