You are not recognized as the original poster of this topic.
Please familiarise yourself with the rules and markup syntax before posting.
url.replace(/https:\/\/([^#]+)(#.+)/,(m,p1,p2)=>p1+encodeURIComponent(p2));