
strings <- c("d1 x2 d2x4 5 specimens collected the smallest is 4 x 1 x 3 mm",
			" stomach x3 d2x4 8 pieces with the largest measuring  4 x 1 x 3 mm")
			
strings <- gsub("\\b(\\d+)(\\s+(?:specimens|pieces))", ".\\1\\2", strings, perl = TRUE)
strings