I want to check whether string contain arabic text or not.
I tried this all answers but nothing is working.
Can some one let me know what regular expression should I use?
nickNameTF.text = @"eweسبيب";
NSLog(@"nickNameTF.textnickNameTF.text===%@", nickNameTF.text);
NSString *emailRegex = @"\p{Arabic}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
if ([emailTest evaluateWithObject:nickNameTF.text]) {
DTAlertView *myAl = [DTAlertView alertViewWithTitle:localize(@"myErr") message:localize(@"srNicc") delegate:nil cancelButtonTitle:localize(@"dismiss") positiveButtonTitle:nil];
[myAl setDismissAnimationWhenButtonClicked:DTAlertViewAnimationSlideTop];
[myAl showWithAnimation:DTAlertViewAnimationSlideBottom];
nickNameTF.enabled = YES;
nickNameTF.userInteractionEnabled = YES;
}
nickNameTF.text = @"يسيس";
// nickNameTF.text = @"adsيسيس";
// nickNameTF.text = @"ads";
NSLog(@"nickNameTF.textnickNameTF.text===%@", nickNameTF.text);
NSString *emailRegex = @"\\p{Arabic}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
if (![emailTest evaluateWithObject:nickNameTF.text]) {
NSLog(@"not trueeeee");
}
if ([emailTest evaluateWithObject:nickNameTF.text]) {
NSLog(@"trueeeee");
}