java - validating a string with RegEx -


i trying validate regex string in java cant work properly. attempting make sure the following string "ab10xy" contained textfield when performing search.

i have following line of code ensures ab , xy in textfield not number:

boolean checkchar = ((textfield.gettext().contains("ab")) && (textfield.gettext().contains("xy"))); 

i prefer have :

boolean checkchar = ((textfield.gettext().contains("ab[\\d]{2}xy"))); 

you can try way

boolean checkchar = ((textfield.gettext().matches(".*?ab[\\d]{2}xy.*"))); 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -