Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

没法识别部分url #67

Open
JianrongHui opened this issue Apr 12, 2017 · 2 comments
Open

没法识别部分url #67

JianrongHui opened this issue Apr 12, 2017 · 2 comments

Comments

@JianrongHui
Copy link

JianrongHui commented Apr 12, 2017

MLLinkLabel.m 文件中识别url的正则表达式少了一种情况,没法识别如 im.qq.com这种url.

@molon
Copy link
Owner

molon commented Apr 13, 2017

@JianrongHui

REGULAREXPRESSION(URLRegularExpression,@"(((http[s]{0,1}|ftp)://|)[a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,6})(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:_/=<>]*)?)|(www.[a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,6})(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:_/=<>]*)?)|(((http[s]{0,1}|ftp)://|)((?:(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d)))\\.){3}(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d))))(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:_/=<>]*)?)")

这个你先试用着吧,这个我考虑下要不要加上。
因为已经用了这个库的人处理link的回调可能直接用的[NSURL URLWithString:linkText] (因为linkText就目前的正则来说肯定是有scheme头的),所以如果我改了的话,那些人的项目会出点小毛病。又不好直接返回一个加了http的linkText,就产生歧义了。当然如果他们都是用的linkValue,给linkValue自动加上http倒是合理。

@BaconTimes
Copy link

@JianrongHui 我觉得你可以自己替换网址的正则表达式啊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants