I have a vector filled with strings of the following format:
the first entries of the vector looks like
You can use sub.
sub("^(.{4}).{4}(.{1}).*([1-9]{1,3})$","\\1\\2\\3",s)