我有一封标准电子邮件,我想从中提取某些详细信息。
在这封电子邮件中,有以下这样的内容行:
<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
我漏掉了什么?