'Incomplete string escaping or encoding

i ran a Code Scanning in Github in my repo , and this line in my JS file

t.location.href.split("#")[0].replace(/<[^>]*>/g,"").replace(/([\('\)])/g,"\\$1").replace(/ /g,"%20")

keeps giving the Alert :

Incomplete string escaping or encoding

Please help me fix it i've stuck here for the whole day .



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source