I'd like to match the lowercase version of an uppercase character in a backreference in a regex. For example, let's say I want to match a string where the 1st character is any uppercase character and the 4th character is the same letter as the first except it's a lowercase character. If I use grep
with this regex:
grep -E "([A-Z])[a-z]{2}\1[a-z]"
it would match "EssEx"
and "SusSe"
for instance. I'd like to match "Essex"
and "Susse"
instead. Is it possible to modify the above regular expression to achieve this ?