Skip navigation.
 
mlRe: NSPredicate and Regexes
FROM : Keary Suska
DATE : Sun Mar 30 17:48:44 2008

on 3/30/08 4:26 AM, <email_removed> 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"

Related mailsAuthorDate
mlNSPredicate and Regexes Romain Pechayre Mar 30, 12:26
mlRe: NSPredicate and Regexes Keary Suska Mar 30, 17:48