从标准形式的字符串中提取值

我有一个字符串,它是通过以下方式构造的:

const string = `text which is always the same. 
values: [${someArray.join(",")}, oneMore]
more text which is always the same. 
other values: [${otherArray.map(someValue => "someLabel" + someValue).join(",")}, oneMore]`

Now I wish to extract all the someValues from an already constructed string (in Javascript).

  • someArray and otherArray can be of arbitrary length
  • someArray and otherArray contain arbitrary alphanumeric strings

我不知道该如何处理。我应该使用正则表达式,还是有更好的方法呢? 如果是前者,我将不胜感激一些以前做过类似事情的例子。