Typescript Variable Inside Regexp Replace Javascript Array Length