• 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
Re: Cocoa-dev Digest, Vol 5, Issue 1970
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa-dev Digest, Vol 5, Issue 1970


  • Subject: Re: Cocoa-dev Digest, Vol 5, Issue 1970
  • From: "Mr. Gecko" <email@hidden>
  • Date: Tue, 18 Nov 2008 14:24:43 -0600

I've finally found it out. I decided to use NSXML instead of Regex and it works perfectly.

NSXMLNode *recived = [[[NSXMLDocument alloc] initWithData:receivedData options:NSXMLDocumentTidyHTML error:NULL] rootElement];
NSArray *recivedA = [recived nodesForXPath:@"//a" error:nil];
int i;
for (i=0; i<[recivedA count]; i++) {
NSXMLElement *link = [recivedA objectAtIndex:i];
NSLog(@"%@", [[link attributeForName:@"href"] stringValue]);
}


Thanks,
Mr. Gecko

On Nov 18, 2008, at 2:02 PM, email@hidden wrote:

NSPredicate can handle ICU standard regex matches.
More info in the NSPredicate docs.
The following snippet validates a UUID.

/*

is UUID

see http://www.stiefels.net/2007/01/24/regular-expressions-for-nsstring/

*/
- (BOOL)isUUID
{
NSString *regex = @"^(([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA- F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12})$";

// supported non standard regex format is at http://www.icu-project.org/userguide/regexp.html
NSPredicate *regextest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
return [regextest evaluateWithObject:self];
}


Jonathan Mitchell

_______________________________________________

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


  • Prev by Date: SOLVED Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)
  • Next by Date: Re: OpenGL + NSTextView/NSTextContainer?
  • Previous by thread: OpenGL + NSTextView/NSTextContainer?
  • Next by thread: Re: OpenGL + NSTextView/NSTextContainer?
  • Index(es):
    • Date
    • Thread