1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 17:59:55 +02:00
This commit is contained in:
DanieL 2022-11-29 18:44:04 -03:00
parent ee76cffb9f
commit c0550f17ee

View file

@ -70,10 +70,13 @@ if (urlParams.has('debug')) {
isDebuging = false; isDebuging = false;
} }
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}
if(typeof String.prototype.replaceAll === "undefined") { if(typeof String.prototype.replaceAll === "undefined") {
console.log('replaceAll is undefined'); console.log('replaceAll is undefined');
String.prototype.replaceAll = function(match, _replace) { String.prototype.replaceAll = function(match, _replace) {
return this.replace(new RegExp(match, 'g'), _replace); return this.replace(new RegExp(escapeRegExp(match), 'g'), _replace);
} }
} }