我正在尝试将关键字与后续字符串匹配
" ABC,PQR(1),XYZ"
如果整个单词与例如匹配,则将成功匹配"帕"或" abc"或" xyz"
任何人都可以帮我为这场比赛创建正则表达式吗?
String text = "hello, hellos(1),bye";
String keyword = "account";
String patternString = "["+ keyword + "]";
Pattern pattern = Pattern.compile(patternString, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(text);
boolean matches = matcher.matches();
System.out.println("matches = " + matches);
答案 0 :(得分:0)