简体   繁体   中英

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 ?

To escape character add \\ .

Like this: /(\\W)C6\\\\add6\\s/ .

试试这个:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM