简体   繁体   English

将URL十六进制代码转换为字符的正则表达式

[英]Regular expressions on converting a URL hex code into character

I have this sample URL with hex code: 我有一个带有十六进制代码的示例URL:

http%3a%2f%2fwww.pmi.com%2feng%2fcareers%2fpages%2fjob_details.aspx%3fjlang%3deng%26jcod%3dUS-02073

I want to formulate a regular expression on converting those hex code into character entities. 我想制定一个将那些十六进制代码转换为字符实体的正则表达式。

%2f => /

Is it possible to have transform the link into this using reg expression? 是否可以使用reg表达式将链接转换为此?

from: 从:

http%3a%2f%2fwww.pmi.com%2feng%2fcareers%2fpages%2fjob_details.aspx%3fjlang%3deng%26jcod%3dUS-02073

output: 输出:

http://www.pmi.com/eng/careers/pages/job_details.aspx?jlang=eng&jcod=US-02073

Like the function of this site: http://www.url-encode-decode.com/?_ga=1.244038725.1379940417.1464232194 类似于此网站的功能: http : //www.url-encode-decode.com/?_ga=1.244038725.1379940417.1464232194

Easier done in C# than Regex: 与正则表达式相比,在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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM