Javascript – Obtain substrings from matching regex
I have this regex const regex = new RegExp(/^${[a-z][a-z0-9_]*}/${[a-z][a-z0-9_]*}$/, 'g'); that matches the string "${total_123}/${number_items}". Next, I want to extract the substrings total123 and number_items and set them as const numerator = total_123 and const denominator = number_items. I'm not…