If you are going to use fixed = TRUE
, use the (non-interpreted) character .
:
> gsub("..", ".", test, fixed = TRUE)
Otherwise, within regular expressions (fixed = FALSE
), .
has a special meaning (any character) so you'll want to prefix it with a backslash to mean "the dot character":
> gsub("\.\.", ".", test)
> gsub("\.{2}", ".", test)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…