Due to a restriction with a URLRewrite module, I am replacing all whitespace in a querystring value with hyphens.
Server side I want to replace the hyphens back to whitespace, which is fine.
However, if there is a hyphen in the querystring (before I encode the value), when I decode the querystring, it removes ALL hyphens, include the one which is meant to be there.
So my question is, how do I achieve the following with a Regex/Regex in C#….
Example 1
……………………………
Querystring: “a-search-term”
Decoded value: “a search term”
Example 2
……………………………
Querystring: “a-hyphenated—search”
Decoded value: “a hyphenated – search”
Also, I’m open for suggestions as to how to handle something like…
Querystring: “up-for–discussion”
Decoded value: “up for -discussion”
Many thanks
Could you do a simple string replace?
This should work for your basic scenarios but it’s not the best solution: