Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getQueryParameterByName(name, searchParams) {
- name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
- const regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
- const results = regex.exec(searchParams);
- return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
- }
Add Comment
Please, Sign In to add comment