Javascript Create Regex Pattern From Variable Frequency