我有这个带有十六进制代码的示例网址:
http%3a%2f%2fwww.pmi.com%2feng%2fcareers%2fpages%2fjob_details.aspx%3fjlang%3deng%26jcod%3dUS-02073
我想在将这些十六进制代码转换为字符实体时制定正则表达式。
%2f => /
是否可以使用reg表达式将链接转换为此链接?
发件人:
http%3a%2f%2fwww.pmi.com%2feng%2fcareers%2fpages%2fjob_details.aspx%3fjlang%3deng%26jcod%3dUS-02073
输出:
http://www.pmi.com/eng/careers/pages/job_details.aspx?jlang=eng&jcod=US-02073
与此网站的功能类似:http://www.url-encode-decode.com/?_ga=1.244038725.1379940417.1464232194
答案 0 :(得分:0)
在C#中比在正则表达式中更容易完成:
using System.Net;
string URL = "http%3a%2f%2fwww.pmi.com%2feng%2fcareers%2fpages%2fjob_details.aspx%3fjlang%3deng%26jcod%3dUS-02073";
string DecodedURL = WebUtility.UrlDecode(URL);