Don't do all this. Use NSDataDetector instead.

(Sent from my iPhone.)

--
Conrad Shultz

On Mar 3, 2012, at 16:15, R <r4eem...@gmail.com> 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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/conrad%40synthetiqsolutions.com
> 
> This email sent to con...@synthetiqsolutions.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to