java中 正则表达式解决连续不同数字问题

匹配ABC4或者AB44 ,A,B,C为任意不相等数字

在java中匹配上诉规则应该是怎样的?
正则菜鸟,求解答,谢过

/^\d{3}[4]$/ /^\d{2}[4]{2}$/
其实没懂什么意思,上面那两个字符串是需要用一个正则表达式还是两个?还是那两个是一个整的字符串?晕乎乎的,不过我也是菜鸟,仅供参考,答错勿怪哦。。。。

按照你给的这两个,基本上就是绝对匹配了,A、B、C、4都是确定的值,如果是这样的话,那就很简单。
举个例子
int a =1044;
int b=1034;
String pattern = "10(3|4)4";

      // 创建 Pattern 对象
      Pattern r = Pattern.compile(pattern);

      // 现在创建 matcher 对象
      Matcher m = r.matcher(String.valueOf(a));
      if (m.find( )) {
            //xxxxxxxxxxxxxxxxxxxxxxxx
            }
            }

                // 现在创建 matcher 对象
      Matcher n = r.matcher(String.valueOf(b));
      if (n.find( )) {
            //xxxxxxxxxxxxxxxxxxxxxxxx
            }
            }

^(\d)(?!\1)(\d)(?!\1|\2)\d4$