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.
NetSuite has launched SuiteSuccess Wholesale Distribution Edition, in Japan. Please join us the webinar on February 12 that introduces NetSuite solution with demos and case studies for Wholesale Industry.
Register Now
Have questions or experiences to share? Post your Release 2026.1 questions and join discussions in the Release 2026.1 category.
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: