Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
Probably easy regular expression question
I’ve seen this code before on the forum and it works great. Pass it the parameter in the URL that you are looking for and it returns the value.
var partnerValue = gup('partner');
/***********************************
Get URL Parameter
***********************************/
function gup(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if (results == null)
return "";
else
return results[1];
}
Using the above, if I have www.mysite.com/index.html?partner=0104-The Cool Store
It would return “0104-The Cool Store”.
However, I want to further parse out what is returned, either in the gup function or by calling another function afterwards. Basically, I want be able to have two values in the end: