var a1 = raw.slice(0, raw.indexOf('[')) + raw.slice(raw.indexOf(']') + 1) var zhi = raw.slice(13, 14) var paper = raw.slice(raw.indexOf(';') + 1) var out = 'variant of <a href="search?id=' + zhi + '">' + zhi + '; ' + paper + '</a>'
Mutoo
2014-04-14 09:26:23 +08:00
var str = "variant of 紙|纸[zhi3]; paper;"; var zhi = str.split(" ")[2].split("|")[1].split(/[\[\]]/)[0]; var paper = str.split(" ")[3].split(";")[0];