1. Password judgment
Contains at least two types of digits, letters (case sensitive), and symbols
NSString *regex = @"^(?![A-Z]+$)(?![a-z]+$)(?!\\d+$)(?![\\W_]+$)\\S+$"; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self matches %@",regex];
If ([predicate evaluatewithobject: textfield. text] = No) {uialertview * alerview = [[uialertview alloc] initwithtitle: Nil message: @ "contains at least two types of digits, letters (case sensitive), and symbols. "Delegate: Self cancelbuttontitle: @" cancel "otherbuttontitles: nil, nil]; [alerview show]; [alerview release];}2. Mobile phone number confirmation
Nsstring * RegEx = @ "^ (13 [0-9]) | (147) | (15 [^ 4, \ D]) | (18 [0, 5-9]) \ D {8} $ "; nspredicate * predicate = [nspredicate predicatewithformat: @" Self matches % @ ", RegEx]; if (! [Textfield. text isequaltostring: @ ""] & [predicate evaluatewithobject: textfield. text] = No) {uialertview * alerview = [[uialertview alloc] initwithtitle: Nil message: @ "enter the correct phone number" delegate: Self cancelbuttontitle: @ "cancel" otherbuttontitles: nil, nil]; [alerview show]; [alerview release];}3. Restrict the user name feature from 3 to 10:
^. {3, 10} $
4. Email
[A-Z0-9a-z. _ % +-] {3,} + @ [A-Za-z0-9.-] + \. [A-Za-Z] {2, 4}
5. The password must contain letters, numbers, and characters.
[A-Za-z0-9] {6, 20}
6. The phone number must be in an appropriate format (for example. ###-###-####)
[0-9] {3} \-[0-9] {3} \-[0-9] {4}
Registration page judgment (regular expression)