I have the text
var text = (hello) world this is (hi) text
I want to write a regex function so I can get
parseText(text) // returns ['hello', 'hi']
I tried this but not work:
'(hello) world this is (hi) text'.match('((.*?))')
Thanks for your help

matchonly returns the first match if you don't use thegflag for the regular expression: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/… . Also you are passing a string literal, not a regular expression which makes things trickier. You can learn about regular expressions here: developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/…