Parenthesis not being replaced in regex

前端 未结 1 1385
情深已故
情深已故 2021-01-28 01:14

I know there are many ways over the internet but this case is a special one.

I need to replace :) with . And

相关标签:
1条回答
  • 2021-01-28 01:26

    You have to escape the parenthesis:

    str.replace(/:\)/g, '<img src="smiley.gif">');
    
    0 讨论(0)
提交回复
热议问题