Looks like the regex in the framework is wrong:
https://github.com/rapid7/metasploit-framework/blob/master/lib/rex/text.rb#L735

http://en.wikipedia.org/wiki/Percent-encoding#Types_of_URI_characters
http://tools.ietf.org/html/rfc3986#section-2.3

_ and ~ are missing