在回答我的一个问题时,有人发布了:
// could replace it with an easier to work with delimiter
str.replace(/(;)(?![";"])/g, '|')
// or split it, but skip over results that are just a ;
var strArr = str.split(/(;)(?![";"])/);
for (s in strArr) {
if (strArr[s] !== ";") {
// do something with strArr[s]
console.log(strArr[s]);
}
}
我完全迷失了/(;)(?![";"])/
。对我来说,它看起来像是一堆随机符号:(。
在哪里可以了解有关正则表达式语法的更多信息?