This could be a dump question, I want to find exact string in case insensitive mode.
So suppose i have string "Test" and I found for "test", it should me return "Test".
I know that I can do that by simply converting to lower case and comparing, but I need regex solution only.
I have tried
String test = "test";
String patternString = "[\\$#@\\^&]" + test + "(\\s|$)";
System.out.println("Test".matches(patternString));
It returns false though I am expecting true. I really don't know what above expression means that's why I am here.
EDIT
I know String.equalsIgnoreCase(another) method, but I told that I need it to do in regex way because I am using spring mongoDB environment so I can match regex into document directly using regex.