I have a regex /[A-Za-z./-]+
, and the text that I want to test is ABCD123
. After the text doesn't pass the regex, I want to display the characters that are not contained at all in the regex. So in this case, I want to display 123 or (1,2,3). How can I do this ?
The question is for java.
LE: The code accepts general regexes and general texts so it has to be a general solution.