我需要删除URL中的#号。例如,我有以下字符串:
message: hello http://www.google.it#readme
我需要删除 '#' 字符。这是我的 node.js 代码:
messagge.replace(new RegExp(/((http|https)\S*#\S*)+/g),function(x){
x.replace('#','');
console.log(x);
});
控制台打印出了链接,但链接没有改变是:http://www.google.it#readme。有人可以帮忙找到解决方案吗?