2017-11-01T12:28:30Z||2017-11-01T12:28:30Z


具体正则可以这样写:<p>(.*?)<\/p>. 括号内的分组就是标签内的内容,代码:

const str = '<h1>haha </h1><div><p>111</p><p>2</p></div><h2>h h haa</h2><p>3 33</p>';
const regex = /<p>(.*?)<\/p>/g;

let match = null;
while (match = regex.exec(str)) {
  console.log(`${match[0]} -> ${match[1]}`);
}

输出:

<p>111</p> -> 111
<p>2</p> -> 2
<p>3 33</p> -> 3 33