如何通过正则匹配出所有的name的value值
const str = '[{"id":"1","name":"t1","children":[{"id":"1","name":"t1-1","children":[]}]},{"id":"1","name":"t2","children":[]}]';
str.match(...)
想要的结果(Array): ['t1', 't1-1',t2]
如何通过正则匹配出所有的name的value值
const str = '[{"id":"1","name":"t1","children":[{"id":"1","name":"t1-1","children":[]}]},{"id":"1","name":"t2","children":[]}]';
str.match(...)
想要的结果(Array): ['t1', 't1-1',t2]
8 回答4.8k 阅读✓ 已解决
6 回答3.5k 阅读✓ 已解决
5 回答2.9k 阅读✓ 已解决
5 回答6.4k 阅读✓ 已解决
4 回答2.3k 阅读✓ 已解决
4 回答2.8k 阅读✓ 已解决
3 回答2.5k 阅读✓ 已解决
后行断言:
/(?<="name":")([^"])+/g