url params
by Gerald Gillespie
JavaScript
const href = `https://tstdrv2311829.app.netsuite.com/app/common/custom/custrecordentrylist.nl?rectype=799&searchtype=Custom&searchid=969&Custom_FORMULATEXT=%25fault%25&CUSTRECORD_TKM_CMETA_SOURCEOBJECT=%40ALL%40&CUSTRECORD_TKM_CMETA_PREVIEWDATATYPE=%40ALL%40&CUSTRECORD_TKM_CMETA_DATATYPE=%40ALL%40&CUSTRECORD_TKM_CMETA_PARENT=%40ALL%40&style=NORMAL&Custom_FORMULATEXTtype=STARTSWITH&report=&grid=&dle=T&sortcol=cfRECORD_6011_raw&sortdir=ASC&csv=HTML&OfficeXML=F&pdf=&size=50&_csrf=hMzqU6NsNO6jrXg_u07yZIgMPGYL2QyR4kGQUnq0X11zdn_fR6AxLhKf93Q0pMqH4IArc4IgWLU5S9zxL0nmnicxkNSGpkfMY6tfM4uvqsiW1B_cwSPr0X5nDpYfyZHLLghP7FtJMIgIzH1ys82Iyg9HbC4rdWblRxZPe5NJI0U%3D&twbx=F&showall=F&quicksort=`;
console.log(
href.replace(/&_csrf=[^=]+/,'')
);
const ids=['someword|TEXT','someword', ''];
ids.forEach( id=>{
console.log(id, id.match(/^[^|]+/),id.match(/(<?:[|]).+/));
console.log( 'splits', id.split('|'), id.split('|')[1])
});
const dataKeys = [ 'hello[]', 'hello[].phrases', 'hi','nested[].hello[]'];
console.log('datakey tests*****')
dataKeys.forEach( dk =>{
console.log( /(\[\])$/i.test(dk), dk, dk.match(/.*(?=\[\]$)/));
})