Search code examples
javascriptescapingslash

How to escape slash '\' in regex?


I need to escape \ in this regax /(\W)***C6/add6***\s/.

I'm using this function to find chord in song and replace to something else.

How can I escape slash ?


Solution

  • Try this one:

    /(\W)*\*\*C6\/add6*\*\*\s/