I have the following string variable that I want to use as part of the pattern of valid characters in Regex.Replace:
string unreservedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
string input = "gzaHQ6PKUgQjXP+/dajkl==";
Is there a simple (hopefully one liner) to replace the characters in input that do not exist in unreservedChars?
You could try the short-hand character ranges: