public static int calcVal(String regex){
  int v=1;
  for (  char c : regex.toCharArray()) switch (c) {
case '\\':
    v+=2;
case '[':
case '(':
case '{':
case '?':
  v+=1;
case '.':
case '*':
case '+':
case '^':
v+=1;
}
return v;
}

public static int calcVal ( String regex ) { int v = 1 ; for ( char c : regex . toCharArray ( ) ) switch ( c ) { case '\\' : v += 2 ; case '[' : case '(' : case '{' : case '?' : v += 1 ; case '.' : case '*' : case '+' : case '^' : v += 1 ; } return v ; }
calculate the value of a expression . the more symbols it uses , the better
