1
janxin 2015-06-19 20:36:35 +08:00
NSString *urlRegEx =
@"(http|https)://((\\w)*|([0-9]*)|([-|_])*)+([\\.|/]((\\w)*|([0-9]*)|([-|_])*))+"; 这个应该就够了把? |
2
lululau 2015-06-19 20:40:44 +08:00
ruby -ruri -e 'puts URI.regexp'
|
3
lk09364 2015-06-19 20:59:50 +08:00
Keywords: regex url stackoverflow
http://stackoverflow.com/questions/161738/what-is-the-best-regular-expression-to-check-if-a-string-is-a-valid-url |
4
zioc 2015-06-19 21:42:17 +08:00
sdk自带的不行吗?不过看不到正则
|
5
earnrepuNey OP |
6
earnrepuNey OP @lk09364 看过,不满足需求
|
7
janxin 2015-06-24 10:48:25 +08:00
@earnrepuNey 没有问题啊,你的意思是不是想匹配不包含http://和https://的url?
|
8
janxin 2015-06-24 10:57:39 +08:00
@earnrepuNey 稍微修改一下就可以了: [(http|https)://]?((\\w)*|([0-9]*)|([-|_])*)+([\\.|/]((\\w)*|([0-9]*)|([-|_])*))+
|
9
earnrepuNey OP |