JS regex replace not working

前端 未结 1 604
花落未央
花落未央 2020-12-21 04:31

I\'ve got a JS string

var str = \'@robot ping\'; 

I need to remove this part of a string

         


        
1条回答
  •  死守一世寂寞
    2020-12-21 05:12

    Use // for regex. Replace " with /.

    var str = '@robot ping'; 
    
    str = str.replace(/

    Documentation for replace

    0 讨论(0)
提交回复
热议问题