📜  javascript url 替换 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:36.635000             🧑  作者: Mango

代码示例1
function URLReplacer(str){
        let match = str.match(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig);
        let final=str;
        match.map(url=>{
            final=final.replace(url,""+url+"")
        })
        return final;
      }