Re: NSURL and NSRegularExpression
Re: NSURL and NSRegularExpression
- Subject: Re: NSURL and NSRegularExpression
- From: R <email@hidden>
- Date: Sat, 03 Mar 2012 17:06:17 -0800 (PST)
Thanks Conrad, much cleaner indeed. But, this does not solve my
invalid internet URL issues.... still accepts pretty much any URL.
I'm wondering how Twitter IOS, and TWTweetComposeViewController
handles URL counting.
On Mar 3, 5:30 pm, Conrad Shultz <email@hidden>
wrote:
> 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.thePiratesWillWinTheWorldSeriesis 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
>
>
> 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