In the original regular expression, the backward reference to the value of the first exciting group contains the г. Воронеж, therefore immediately after the г. Воронеж, another г. Воронеж, should follow, but the comma should be followed by a space.
Use
p <- "(г\\.\\s*[[:alpha:]]+)(?:,\\s*\\1)+" x <- "г. Воронеж, г. Воронеж, г. Воронеж, ул. Ленинский пр-т,174" gsub(p,"\\1", x, ignore.case = TRUE)
See R-demo online
Description :
(г\.\s*[[:alpha:]]+) - Exciting group number 1:г\. - г.\s* - 0+ spaces[[:alpha:]]+ - 1+ letters
(?:,\\s*\\1+)+ - 1+ repetitions of the following patterns:,\\s* - comma + zero and more spaces\\1 is the value in the first exciting group.