MaxSchmeling
20p16 comments posted · 0 followers · following 0
100 weeks ago @ Max Schmeling - Replace Query String P... · 0 replies · +1 points
103 weeks ago @ Max Schmeling - RegEx FAIL - Answer · 0 replies · +1 points
103 weeks ago @ Max Schmeling - RegEx FAIL - Answer · 0 replies · +1 points
I took some time and came up with a much better expression, that's much simpler and actually works. Try this instead: "{0}=[^&]+"
Full Method:
public static string ReplaceValue(string url, string parameter, string newValue)
{
return Regex.Replace(url, string.Format("{0}=[^&]+", parameter),
string.Format("{0}={1}", parameter, newValue), RegexOptions.IgnoreCase);
}
Thank you for pointing out the issue. I've only used the code for really simple urls so I'll have to replace it with the updated method that will work with any url.
119 weeks ago @ Max Schmeling - Who are you comparing ... · 0 replies · +1 points
128 weeks ago @ Max Schmeling - Who are you comparing ... · 0 replies · +1 points
128 weeks ago @ Max Schmeling - Finite State Machine R... · 1 reply · +1 points
128 weeks ago @ Max Schmeling - RegEx FAIL · 0 replies · +1 points
http://maxschmeling.blogspot.com/2009/01/regex-fa...
129 weeks ago @ Max Schmeling - Extension Method for E... · 0 replies · +1 points
133 weeks ago @ Max Schmeling - AzMan Documentation · 0 replies · +1 points
136 weeks ago @ Max Schmeling - Authorization Manager · 0 replies · +1 points
Branch