I am trying to validate a RegEx string in Java but i cant get it to work properly. I am attempting to make sure the the following string "AB10XY" is always contained with the textField when performing a search.
I have the following line of code which ensures that AB and XY are in the textField but not the number:
boolean checkChar = ((textField.getText().contains("AB")) && (textField.getText().contains("XY")));
I would prefer to have something like :
boolean checkChar = ((textField.getText().contains("AB[\\d]{2}XY")));