0
當我重新初始化yajra數據表時,出現此錯誤 未捕獲的SyntaxError:無效的正則表達式:/(^|.)dt(.|$)/:堆棧溢出
可能是什麼原因。
當我重新初始化yajra數據表時,出現此錯誤 未捕獲的SyntaxError:無效的正則表達式:/(^|.)dt(.|$)/:堆棧溢出
可能是什麼原因。
如果正則表達式確實是/(^|.)dt(.|$)/:
那麼尾隨:
在javascript中不好,那麼正則表達式應該以/
開始和結束。
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
唯一允許的選項是克米I UÝ(最後/
後): https://regex101.com/r/l7mwwt/1
const regex = /(^|.)dt(.|$)\/:/gmiuy;
const str = ``;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
如果你想要匹配/:
litteral,你應該逃脫你的斜線
它可能與此有關,但是你可以在什麼時間和地點發生什麼? https://laravel.com/docs/5.5/validation#rule-regex – Loek