Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPredicate and Regexes



on 3/30/08 4:26 AM, email@hidden purportedly said:

> NSString* regexFormat=@"[+-]?([0-9]*\.?[0-9]+)?[A-Z|a-z][A-Z|a-z|
> 0-9]*([+-]?([0-9]*\.?[0-9]+)?[A-Z|a-z][A-Z|a-z|0-9]*)*";
> NSString* equation =@"X1+2X2+3X3";

The compiler should have warned you about this: backslashes indicate escape
sequences, so all your '\.' become plain old '.' when the string is parsed.
You should instead use '\\.'. The NSPredicate examples show this.

I suspect that Python has quoting semantics like Perl, so the backslashes
aren't seen as escape sequences, as they would if the string was
double-quoted.

Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >NSPredicate and Regexes (From: Romain Pechayre <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.