I have the following regex in javascript. I want the string to match the string product (,|x) quantity, each price . The following regex does this; however, it returns an array with only one element. I want an array that returns the entire matched string first, and then the product, quantity, each price.
(, | x) means a comma or x, so it will match ice-cream, 99, $99 or ice-cream x 99, $99
How can i do this?
source share