I'm having a strange bug when I try to check an EditText (I want the text to be an IBAN, like FR76 2894 2894 2894 289), so I'm doing this (overriding my edit text's onTextChanged):
// format with IBAN regex
@Override
protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
    editText.setText(editText.getText().toString().replaceAll(" ", "")
            .toUpperCase().replaceAll("[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{4}[0-9]{7}([a-zA-Z0-9]?){0,16}", "$0 ")); 
}
I'm doing a comparison with two different Android phones: an Asus Zenfone and an Honor 5C.
Both devices have the same bevahiour on first char typed (valid only if it's a letter). But then, when I type a second letter (text should be FR after this):
Honor 5C: (expected behaviour)
Asus Zenfone: (wrong behaviour)
Any idea? Thanks for your help.


 
     
    