You could do the following: ^0*1*2*3*4*5*6*7*8*9*$
to detect increasing, ^9*8*7*6*5*4*3*2*1*0*$
to decreasing and ^0*|1*|2*|3*|4*|5*|6*|7*|8*|9*$
to repeated, eg:
import java.util.regex.Pattern;
class Main {
public static void main(String args[]) {
// match crescente
System.out.println(Pattern.matches("^0*1*2*3*4*5*6*7*8*9*$", "1368"));
System.out.println(Pattern.matches("^0*1*2*3*4*5*6*7*8*9*$", "9321"));
// match decrescente
System.out.println(Pattern.matches("^9*8*7*6*5*4*3*2*1*0*$", "1368"));
System.out.println(Pattern.matches("^9*8*7*6*5*4*3*2*1*0*$", "9321"));
// match repetidos
System.out.println(Pattern.matches("^0*|1*|2*|3*|4*|5*|6*|7*|8*|9*$", "1111111111111"));
System.out.println(Pattern.matches("^0*|1*|2*|3*|4*|5*|6*|7*|8*|9*$", "1111111111112"));
}
}
that will get you back:
true
false
false
true
true
false