开发者

Regular expression for unicode URL

There is a regex for URL but it does not support unicode characters.

^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-开发者_Go百科9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?

I want to use it in both javascript and C#


Replace every occurrences of a-zA-Z by \pL.

Thanks to @Lesley:

Unicode properties are not available in javascript, we have to use a package like regexp.


As you are using Unicode characters I think that you want to get non english language (like Arabic, hebrew or persian....) so just chage the are from a-z A-Z to ا-ی or other equivalents

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜