(如何)可以在下面的正则表达式进行简化: ab|a|b
? 我正在寻找一个不太多余的,即只有一个a和一个b。可能吗? 一些尝试: a?b? # matches empty string while shouldn't
ab?|b # still two b
注意,真正的正则表达式有更复杂a和b部分,即不是单个字符,但内subregexes让我们说。
我犯了这个错误。我认为这是错误的。 public void display() {
for (int i = 0; i < tabT.length; i++)
if (tabT[i] != null)
for (int j = 0; j <= i; j++)
if (tabT[i] != tabT[j])
System.out.