Regexp Substr Function In R