var body1 = `123 23
1000113700005953171
456
1234
123333
abc dsafdsa
1000113700005951591
1000113700005951264
ok`;
// 正则,19位卡号
const re = /^1000[0-9]{15}$/;
// 换行拆分
var rows = body1.split(/[(\r\n)\r\n]+/);
var cards = [];
// 匹配
// ECMASCRIPT 6
// var cards = rows.filter(card => card.trim().match(re));
rows.forEach(function (item, index) {
if (item == "third") {
//throw new Error("EndIterative");
}
var card = item.trim().match(re);
if (card) cards.push(card[0]);
//alert(item);// first,sencond
});
// console.log(cards[1][0]);
var str_cards = JSON.stringify(cards);
console.log(str_cards);
console