I am using Java and I need to validate a numeric sequence like this: 9999/9999.
I tried using this regex \\d{4}\\\\d{4}, but I am getting false for 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 anyone help me, please?