I have the following codes
"ABC.A.SVN.10.10.390.10.UDGGL"
"XYZ.Z.SVN.11.12.111.99.ASDDL"
and I need to replace the characters that exist between the 2nd and the 3rd dot. In this case it is SVN
but it may well be any combination of between A
and ZZZ
, so really the only way to make this work is by using the dots.
The required outcome would be:
"ABC.A..10.10.390.10.UDGGL"
"XYZ.Z..11.12.111.99.ASDDL"
I tried variants of grep("^.+(\\.\\).$", "ABC.A.SVN.10.10.390.10.UDGGL")
but I get an error.
Some examples of what I have tried with no success :
EDIT
I tried @Onyambu 's first method and I ran into a variant which I had not accounted for: "ABC.A.AB11.1.12.112.1123.UDGGL"
. In the replacement part, I also have numeric values. The desired outcome is "ABC.A..1.12.112.1123.UDGGL"
and I get it using sub("\\.\\w+.\\B.",".",x)
per the second part of his answer!