0

I have been trying to match the following sequence "/1" in various ways, but none of them are working. I am matching division by 1 at the end of a string. Here's what I have tried:

String m = "1204/1"
pattern = "[\\/1]+$"; \\doesn't work
pattern = "(\\/1)$"; \\doesn't work
pattern = "[\\1,1]{2}$"; \\doesn't work
if(m.matches(pattern)System.out.println("Ham");
else System.out.println("cheese");

all I have been getting as output is "cheese". Any ideas would be great.

thanks

i_o
  • 621
  • 9
  • 24

0 Answers0