public static string ReplaceMarkersWithRawValues(StringView text, out QueryMarker[] markers) { markers = ParseAllMarkers(text); if (markers == null || markers.Length == 0) { return(text.ToString()); } var modifiedSv = text.GetSubsetStringView(); foreach (var queryMarker in markers) { if (!queryMarker.valid || queryMarker.args == null || queryMarker.args.Length == 0) { continue; } var valueArg = queryMarker.args[0]; modifiedSv.ReplaceWithSubset(queryMarker.text.startIndex, queryMarker.text.endIndex, valueArg.rawText.startIndex, valueArg.rawText.endIndex); } return(modifiedSv.ToString()); }