In my iOS project I want to validate the password ,where I should accept the password which is strictly alphanumeric,,i.e Passoword must contains both alphabets and Numbers , I have done this by the following method, But It is taking numbers as optional,, It looks simple but its eating my time,,pls help me out
NSError *error = NULL;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"[a-z0-9]*"
options:NSRegularExpressionCaseInsensitive
error:&error];
NSArray *matches = [regex matchesInString:input
options:0
range:NSMakeRange(0, [input length])];
if([matches count] > 0)
{
// Valid input
return true;
}
else
{
return false;
}