字符串:
<row>1</row>
<row>2</row>
正则表达式:
<row>([\s\S]*?)<\/row>/gm
结果:
["<row>1</row>", "<row>2</row>"]
期望的结果
["1", "2"]
答案 0 :(得分:0)
以下是一个示例:http://jsfiddle.net/zgdksaax/
var pattern = /<row>([\s\S]*?)<\/row>/gm;
var string = "<row>1</row><row>2</row>";
console.log(string.replace(pattern, "$1").split("")) // ["1", "2"]