In Java, when doing a replaceAll to look for a regex pattern like:
replaceAll("\?i\b(\w+)\b(\s+\1)+\b", "$1");
(to remove duplicate consecutive case-insensitive words, e.g. Test test), I'm not sure where I put the ?i
. I read that it is supposed to be at the beginning, but if I take it out then i catch duplicate consecutive words (e.g. test test), but not case-insensitive words (e.g. Test test). So I thought I could add the ?i in the beginning but that does not seem to get the job done. Any thoughts? Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…