在回答我的問題之一,有人貼出:瞭解正則表達式?
// 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]);
}
}
我在/(;)(?![";"])/
完全喪失。它看起來像一堆隨機符號給我:(
我在哪裏可以瞭解更多有關正則表達式語法
http://www.regular-expressions.info/和https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions –