Re: NSURL and NSRegularExpression
Re: NSURL and NSRegularExpression
- Subject: Re: NSURL and NSRegularExpression
- From: Conrad Shultz <email@hidden>
- Date: Sat, 03 Mar 2012 16:30:33 -0800
Don't do all this. Use NSDataDetector instead.
(Sent from my iPhone.)
--
Conrad Shultz
On Mar 3, 2012, at 16:15, R <email@hidden> wrote:
> I'm building a twitter app for the iphone and want to detect valid
> internet url's and set their character count to <= 20.
>
> I'm using NSRegularExpression to build an array of all NSRanges in the
> text field that start with "http". I then use NSScanner to scan until
> it finds whitespace or end of line characters for each
> range.location. I then place this new subString into a NSURL to
> validate that it does not return nil.
>
> I'm finding that NSURL pretty much likes everything.....
> http://www.cnn.thePiratesWillWinTheWorldSeries is happy.
>
> Is there a good way to validate a NSURL for the internet, short of
> pinging?
>
> My next step is to find the end of the substring, count back three
> characters and check for com,edu or org... seems clunky and inaccurate
> for future internet standards.
>
> Thanks -- Ron
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden