title: Regex for not allowing consecutive dots or underscores
body: <p>I have a Regex which allows only alpha numeric characters along with dot (.) and underscore (_)</p>
  
  <p>It does not allow consecutive underscores but it allows consecutive dots. Can anyone please guide me through this problem. I don't want consecutive dots or underscores. 
  Below is the JavaScript function</p>
  
  <pre><code>function checkLogin() {
    var login = $("#user_login").val();
    var regex = new RegExp("^(?!.*__.*)[a-zA-Z0-9_.]+$");
    var flag = true;
    if (regex.test(login)) {
      $('#valid_character_error').css("display","none");
    } 
    else  {
      $('#valid_character_error').css("display","block");
      flag = false;
    }
    return flag;
  }
  </code></pre>