NSPredicate error/behaving differently on 10.5 vs 10.6
Posted
by Tristan
on Stack Overflow
See other posts from Stack Overflow
or by Tristan
Published on 2010-05-29T01:32:51Z
Indexed on
2010/05/29
1:42 UTC
Read the original article
Hit count: 361
I am using a NSPredicate to determine if an entered email address is valid. On 10.6 it works perfectly as expected. I recently decided to get my app going on 10.5 and this is the only thing that doesn't work.
The error i get is as follows:
"Can't do regex matching, reason: Can't open pattern U_MALFORMED_SET (string [email protected], pattern ([\w-+]+(?:\.[\w-+]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}), case 0, canon 0)"
The code im using is as follows:
NSString *regex = @"([\\w-+]+(?:\\.[\\w-+]+)*@(?:[\\w-]+\\.)+[a-zA-Z]{2,7})";
NSPredicate *regextest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
if ([regextest evaluateWithObject:[userEmail objectValue]] == YES)
Does anyone know why this isn't working on 10.5? And how I might get it working or be able to do this test in a way compatible for both 10.5 and 10.6?
© Stack Overflow or respective owner