name = name.replace(/%([0-9a-f]{2})/gi, Escape);
function Escape(match0, match1, index, source) {
return String.fromCharCode(parseInt("0x" + match1));
}
Is there an alternative to findBounds()?
import future, strutils
import nre
var name = "Hello,%20World%21"
name = name.replace(
re"%[0-9a-f]{2}",
(s: string) => $chr(parseHexInt(s.substr(1)))
)
Alternatively
name = name.replace(
re"%([0-9a-f]{2})",
(m: RegexMatch) => $chr(parseHexInt(m.captures[0]))
)