<分区>
我有一封标准电子邮件,我希望从中提取某些详细信息。
邮件中有这样几行:
<strong>Name:</strong> John Smith
因此,为了模拟这一点,我有以下 JavaScript:
var str = "<br><strong>Name:</strong> John Smith<br>";
var re = /\<strong>Name\s*:\<\/strong>\s*([^\<]*)/g
match = re.exec(str);
while (match != null) {
console.log(match[0]);
match = re.exec(str);
}
这只会得出一个结果,即:
<strong>Name:</strong> John Smith
我希望得到捕获组 ([^\<]*)
在本例中为 John Smith
我在这里错过了什么?