Javascript Use Variable Inside Regex Pattern Meaning