I have the following regex in Java:
private static final String ALPHA_REGEX = "[^A-Za-z]+$";
If I input say “a334234234” the validation will fail. However if I input “a3423423fsfsdf” the validation succeeds…
Same goes for the following regex which checks whether the input is numeric only:
private final static Pattern NUMBER_ONLY_PATTERN = Pattern.compile("[^0-9 ]+$", Pattern.CASE_INSENSITIVE);
If I input 4saasd the validation fails, but if I input 3dfsdf22 the validation is successful. Can you help me with this?
^in[]meannot, but without[]it means beginning of string, this is your issue^[a-zA-Z]+$– only letter^\d+$– only digit