Is there a way to use highlight-regexp
in a case-insensitive way? I'm parenthesizing an expression in my regexp and refer to it using \1
later and I want to match this regardless of case. I'm trying to find occurrences of repeated words (with maybe some other words in between), even if they are differently capitalized, e. g. in
One two three. Four five six four seven eight nine.
I would like to highlight the phrase Four five six four
due to the repeated word four
. My approach is this regexp:
\b\(\w+\)\b\W+\(\b\w+\b\W+\)\{0,10\}\1\b
I will work fine for repeated words with exactly equal capitalization but it does not work if the capitalization doesn't match.
I also tried setting case-fold-search
to various values but it does not seem to be used for highlight-regexp
.
Is there any way to highlight my repeated word case?