MaxSchmeling
20p16 comments posted · 0 followers · following 0
1 week ago @ Max Schmeling - Replace Query String P... · 0 replies · +1 points
4 weeks ago @ Max Schmeling - RegEx FAIL - Answer · 0 replies · +1 points
4 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.
20 weeks ago @ Max Schmeling - Who are you comparing ... · 0 replies · +1 points
29 weeks ago @ Max Schmeling - Who are you comparing ... · 0 replies · +1 points
29 weeks ago @ Max Schmeling - Finite State Machine R... · 1 reply · +1 points
29 weeks ago @ Max Schmeling - RegEx FAIL · 0 replies · +1 points
http://maxschmeling.blogspot.com/2009/01/regex-fa...
30 weeks ago @ Max Schmeling - Extension Method for E... · 0 replies · +1 points
34 weeks ago @ Max Schmeling - AzMan Documentation · 0 replies · +1 points
37 weeks ago @ Max Schmeling - Authorization Manager · 0 replies · +1 points
Branch