java - Validating numeric sequence -


i using java , need validate numeric sequence this: 9999/9999.

i tried using regex \\d{4}\\\\d{4}, getting false matches().

my code:

    pattern regex = pattern.compile("\\d{4}\\\\d{4}");      if (!regex.matcher(mysequence).matches()) {         system.out.println("invalid");     } else {         system.out.println("valid");     } 

can me, please?

the regex pattern attempting match backslash rather forward slash character. need use:

pattern regex = pattern.compile("\\d{4}/\\d{4}") 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -