javascript - 将字符串数组更改为字符串数组

标签 javascript regex string

<分区>

我有一个包含数组的字符串:

"[one, two, three]"

我想把它变成一个字符串数组,像这样:

["one", "two", "three"]

如有任何帮助,我们将不胜感激!

更新: 谢谢大家的帮助,你可以在这里看到这个结果: http://kittykatattack.github.io/storymaker/

最佳答案

试试这个:

'[one, two, three]'.match(/\w+/g);

关于javascript - 将字符串数组更改为字符串数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20052472/

相关文章:

带有多个分隔符和表达式的javascript分割字符串

regex - 如何使用 ColdFusion 从 XML 字符串中删除所有多余的空格?

ruby-on-rails - 用于 strip 化非字母和非数字字符的正则表达式

c - getline 不将字符串存储在变量中

c++ - 如何将 "char"转换为 "std::string"?

javascript - jQuery .when 未按预期与休息运算符一起工作

javascript - 正则表达式/JavaScript : Convert Degrees Minutes Seconds to Decimal Degrees

javascript - 动态生成多个 d3 svg 图

java - 使用动态字符串引用 arraylist

javascript - javascript中的两个 ";"是什么意思