s = 'there is a cat in the hat.it has a 2.0 inch tail!'
puts s.gsub(/(\A|[.?!])(\p{Ll})/) { Regexp.last_match(1).length > 0 ? "#{$1} #{$2.capitalize}" : "#{$2.capitalize}" }
cyA9ICd0aGVyZSBpcyBhIGNhdCBpbiB0aGUgaGF0Lml0IGhhcyBhIDIuMCBpbmNoIHRhaWwhJwpwdXRzIHMuZ3N1YigvKFxBfFsuPyFdKShccHtMbH0pLykgeyBSZWdleHAubGFzdF9tYXRjaCgxKS5sZW5ndGggPiAwID8gIiN7JDF9ICN7JDIuY2FwaXRhbGl6ZX0iIDogIiN7JDIuY2FwaXRhbGl6ZX0iIH0=