Is Java RegEx case-insensitive?

后端 未结 5 842
死守一世寂寞
死守一世寂寞 2020-11-28 05:40

In Java, when doing a replaceAll to look for a regex pattern like:

replaceAll(\"\\\\?i\\\\b(\\\\w+)\\\\b(\\\\s+\\\\1)+\\\\b\", \"$1\"); 

(t

5条回答
  •  执念已碎
    2020-11-28 06:34

    RegexBuddy is telling me if you want to include it at the beginning, this is the correct syntax:

    "(?i)\\b(\\w+)\\b(\\s+\\1)+\\b"
    

提交回复
热议问题