I wrote this to detect if the url contain this particular keyword i.e. recordId but if url contains it in lower i.e. recordid then it doesn’t detect.
How do I make them detect both because data can have both recordid or recordId.
if(url && url.includes("recordId") && url.includes("rt")){
this._geRecordId(url);
}
private async geRecordId(url){
const linkedId = this._getURLValue('recordId' , url);
if(!linkedId){
return;
}
private _getURLValue( name, url ) {
if (!url) url = location.href;
name = name.replace(/[[]/,"\[").replace(/[]]/,"\]");
var regexS = "[\;]"+name+"=([^;]*)";
var regex = new RegExp( regexS );
var results = regex.exec( url );
return results == null ? null : results[1];
}
I tried changing regex