Answers for "remove a parameter froma string"

0

remove a parameter froma string

function removeParameterFromUrl(url, parameter) {
  const replacer = (m, p1, p2) => (p1 === '?' && p2 === '&' ? '?' : p2 || '')
  return url.replace(new RegExp(`([?&])${parameter}=[^&#]+([&#])?`), replacer)
}
Posted by: Guest on September-09-2021

Code answers related to "remove a parameter froma string"

Browse Popular Code Answers by Language