Re: NSPredicate and Regexes
Re: NSPredicate and Regexes
- Subject: Re: NSPredicate and Regexes
- From: Keary Suska <email@hidden>
- Date: Sun, 30 Mar 2008 09:48:44 -0600
- Thread-topic: 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:
This email sent to email@hidden