I want to convert array like looking string into array.
for ex:
from string
var str = "['Asian', 'Japanese', 'Vegetarian Friendly', 'Vegan Options', 'Gluten Free
Options']"
to array
['Asian', 'Japanese', 'Vegetarian Friendly', 'Vegan Options', 'Gluten Free Options']
I have tried this with regex
str.match(/'[a-z]*'/gi).map((elm)=>{
return elm.replace(/'/g,"")
})
but this is not considering the spaces in between or more than one word.
Please let me know the efficient solution.
'to"and thenJSON.parse. But if you have an apostrophe on any of the items, then it won't work'[^']*'...