I am trying to validate a password with those characteristics but I can't find a regex that can fulfill this condition.
In case you couldn't and you had an idea of how to do that validation in kotlin/android it would be very helpful, thanks.
I am trying to validate a password with those characteristics but I can't find a regex that can fulfill this condition.
In case you couldn't and you had an idea of how to do that validation in kotlin/android it would be very helpful, thanks.
You can convert the below code to kotlin. Basically add a regex then use a onTextChangedListener to see if the text that has already been entered conforms to the regular expression mentioned before
String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
emailValidate .addTextChangedListener(new TextWatcher() { 
    public void afterTextChanged(Editable s) { 
    if (email.matches(emailPattern) && s.length() > 0)
        { 
            Toast.makeText(getApplicationContext(),"valid email address",Toast.LENGTH_SHORT).show();
            // or
            textView.setText("valid email");
        }
        else
        {
             Toast.makeText(getApplicationContext(),"Invalid email address",Toast.LENGTH_SHORT).show();
            //or
            textView.setText("invalid email");
        }
    } 
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    // other stuffs 
    } 
    public void onTextChanged(CharSequence s, int start, int before, int count) {
    // other stuffs 
    } 
}); 
Code Source: Stackoverflow answer on email validation
 
    
    Do you mean this?
fun checkPassw(value: String): Boolean {
    val regex = Regex("^(?!.*(\\w)\\1).+$")
    return regex.matches(value)
}
