How to find the exact word using a regex in Java?

前端 未结 6 1926
既然无缘
既然无缘 2020-11-30 07:01

Consider the following code snippet:

String input = \"Print this\";
System.out.println(input.matches(\"\\\\bthis\\\\b\"));

Output



        
6条回答
  •  情话喂你
    2020-11-30 07:03

    Is your searchString going to be regular expression? if not simply use String.contains(CharSequence s)

提交回复
热议问题