It sounds like you wish to replace a period with a space if it is preceded or followed by a period, and I've assumed that there is not necessarily a colon preceding a string of periods. If so, here are two ways to do that.
str = "Domain:...................google.com"
Use Enumerable#each_cons instead of a regex
" #{str} ".each_char.each_cons(3).map { |before,ch,after|
ch=='.' && (before=='.' || after== '.') ? ' ' : ch }.join
#=> "Domain: google.com"
The steps are as follows.
s = " #{str} "
#=> " Domain:...................google.com "
a = s.each_char
#=> #<Enumerator: " Domain:...................google.com ":each_char>
e = a.each_cons(3)
#=> #<Enumerator: #<Enumerator: " Domain:...................google.com ":
# each_char>:each_cons(3)>
Notice how e can be thought of as a compound enumerator. We can see the elements that will generated by this enumerator by converting it to an array.
e.to_a
#=> [[" ", "D", "o"], ["D", "o", "m"], ["o", "m", "a"], ["m", "a", "i"],
# ["a", "i", "n"], ["i", "n", ":"], ["n", ":", "."], [":", ".", "."],
# [".", ".", "."], [".", ".", "."], [".", ".", "."], [".", ".", "."],
# [".", ".", "."], [".", ".", "."], [".", ".", "."], [".", ".", "."],
# [".", ".", "."], [".", ".", "."], [".", ".", "."], [".", ".", "."],
# [".", ".", "."], [".", ".", "."], [".", ".", "."], [".", ".", "."],
# [".", ".", "."], [".", ".", "g"], [".", "g", "o"], ["g", "o", "o"],
# ["o", "o", "g"], ["o", "g", "l"], ["g", "l", "e"], ["l", "e", "."],
# ["e", ".", "c"], [".", "c", "o"], ["c", "o", "m"], ["o", "m", " "]]
Continuing,
b = e.map { |before,ch,after| ch=='.' && (before=='.' || after== '.') ? ' ' : ch }
#=> ["D", "o", "m", "a", "i", "n", ":", " ", " ", " ", " ", " ", " ", " ",
# " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "g", "o",
# "o", "g", "l", "e", ".", "c", "o", "m"]
b.join
#=> "Domain: google.com"
Use a regex
r = /
(?<=\A|\.) # match the beginning of string or a period in a positive lookbehind
\. # match a period
| # or
\. # match a period
(?=\.|\z) # match a period or the end of the string
/x # free-spacing regex definition mode
str.gsub(r,' ')
#=> "Domain: google.com"
.gsub(/(?<!^|\w)\.|\.(?!\w|$)/, ' '), no need for blocks. Or with a block -/\.{2,}/(and use the same block as in the answer below) - Wiktor Stribiżew