• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSURL and NSRegularExpression
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSURL and NSRegularExpression


  • Subject: NSURL and NSRegularExpression
  • From: R <email@hidden>
  • Date: Sat, 03 Mar 2012 16:15:16 -0800 (PST)

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


  • Follow-Ups:
    • Re: NSURL and NSRegularExpression
      • From: Conrad Shultz <email@hidden>
  • Prev by Date: Re: Image Colours
  • Next by Date: Re: NSURL and NSRegularExpression
  • Previous by thread: Re: Unclear on -initWithBytesNoCopy:
  • Next by thread: Re: NSURL and NSRegularExpression
  • Index(es):
    • Date
    • Thread