How to use Regex Groups Capturing in I/O Tests?

Hey guys,

Given this question: “Write a program that prints a two-digit number with identical digits (e.g. 11, 22, 77 ect.)”.

I try to set an I/O test that checks if the program prints a two-digit number with identical digits, and I want to use Regex with Groups Capturing (and yes, I know that I can just use 11|22|…|99).


This is a possible program:

class Main {
  public static void main(String[] args) {
    System.out.println("55");
  }
}

I tried these regexes (in the "Expected output" area):
(.)\\1
(.)\\1\\n
(.)\\1\n
(.)\\1\\s
(.)\\1\s
(.)\\1\s*
(.)\\1\\s*

/*
These causes the error: 
"unable to compile regex expression: 
error parsing regexp: invalid escape sequence: `\1`":
*/
(.)\1
(.)\1\n
(.)\1\\n
(.)\1\\s
(.)\1\s

But none of them worked… how should I do that?