title: how to do validation for username in [objective-c]?
body: <p>my requirement for <code>validation</code> is to validate <code>username</code> which allows to enter small a-z,and 0-9, and only two symbol <code>_</code> and <code>.</code>(dot) </p>
  
  <p>but symbol do not repeat.</p>
  
  <p>and symbol not allowed at the starting of the name.</p>
  
  <p>can any one help me ?? how to do this <code>validation</code>?</p>
  
  <p>i have tried this code but it works fine but it repeats symbol how can i avoid to repeat?</p>
  
  <pre><code>- (BOOL)validateString:(NSString*)stringToSearch
  {
      NSString *emailRegex = @"[a-z0-9._]{5,15}";
      NSPredicate *regex = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
      return [regex evaluateWithObject:stringToSearch];
  
  
  
  }
  </code></pre>