Match @(\w+) and replace in javascript

前端 未结 2 1728
你的背包
你的背包 2021-01-28 12:36

I\'m trying to match @(\\w+) in a div content and remove it.

Here\'s what i\'ve tried : http://jsfiddle.net/mxgde6m7/1/ .

@(\\w+) works , but it doesn\'t replace

2条回答
  •  自闭症患者
    2021-01-28 13:02

    Using a RegExp constructor, you need two backslashes \\ in place of each backslash \.

    var find = '@(\\w+)';
    

提交回复
热议问题