iOS 开发实用技术导航
NSHipster 中文版
› http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
› http://www.cocos2d-iphone.org/
CocoaPods
› http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
› http://code.google.com/mobile/analytics/
WWDC
› https://developer.apple.com/wwdc/
Design Guides and Resources
› https://developer.apple.com/design/
Transcripts of WWDC sessions
› http://asciiwwdc.com
Cocoa with Love
› http://cocoawithlove.com/
Cocoa Dev Central
› http://cocoadevcentral.com/
NSHipster
› http://nshipster.com/
Style Guides
› Google Objective-C Style Guide
› NYTimes Objective-C Style Guide
Useful Tools and Services
› Charles Web Debugging Proxy
› Smore
earnrepuNey
V2EX  ›  iDev

有没有 iOS 最强大的 URL 正则表达式?

  •  
  •   earnrepuNey · Jun 19, 2015 · 5746 views
    This topic created in 4156 days ago, the information mentioned may be changed or developed.
    网上能找到的都是针对特定的 URL 格式。有没有能匹配最广的?像微信能识别 t.tt, google.gm 这样的,有没有一个开源的 URL 正则表达式?
    9 replies  •  2015-07-03 15:28:33 +08:00
    janxin
    janxin
    Jun 19, 2015
    1
    NSString *urlRegEx =
    @"(http|https)://((\\w)*|([0-9]*)|([-|_])*)+([\\.|/]((\\w)*|([0-9]*)|([-|_])*))+";
    这个应该就够了把?
    lululau
    lululau
    Jun 19, 2015
    2
    ruby -ruri -e 'puts URI.regexp'
    zioc
    zioc
    Jun 19, 2015
    4
    sdk自带的不行吗?不过看不到正则
    earnrepuNey
    earnrepuNey
    OP
    Jun 24, 2015
    5
    @janxin t.tt 你试试
    earnrepuNey
    earnrepuNey
    OP
    Jun 24, 2015
    6
    @lk09364 看过,不满足需求
    janxin
    janxin
    Jun 24, 2015
    7
    @earnrepuNey 没有问题啊,你的意思是不是想匹配不包含http://和https://的url?
    janxin
    janxin
    Jun 24, 2015
    8
    @earnrepuNey 稍微修改一下就可以了: [(http|https)://]?((\\w)*|([0-9]*)|([-|_])*)+([\\.|/]((\\w)*|([0-9]*)|([-|_])*))+
    earnrepuNey
    earnrepuNey
    OP
    Jul 3, 2015
    9
    @janxin 谢谢你的耐心回复。我很好奇微信能够识别 t.tt google.gm 这样的网址。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2888 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 11:01 · PVG 19:01 · LAX 03:01 · JFK 06:01
    ♥ Do have faith in what you're doing.