网页歌词翻译匹配校验器
import * as fs from 'fs'; // 读取HTML文件 const t1 = fs.readFileSync('./txt1.txt').toString(); const t2 = fs.readFileSync('./txt2.txt').toString() // console.log(t1, t2); const t1Lines = t1.split('\n'); const t2Lines = t2.split('\n'); // console.log(t1Lines) for (let i = 0; i < t1Lines.length; i++) { const line1 = t1Lines[i].match(/\[\d{1,2}:\d{1,2}\.\d{1,3}\]/g) || []; const line2 = t2Lines[i].match(/\[\d{1,2}:\d{1,2}\.\d{1,3}\]/g) || []; if (line1[0] !== line2[0]) { console.log(t1Lines[i], ':', t2Lines[i]); } }