Can't escape the backslash with regex?

前端 未结 6 672
别那么骄傲
别那么骄傲 2020-11-22 09:04

I\'m using the following regex

^[a-zA-Z0-9\\\',!;\\?\\$\\^:\\\\\\/`\\|~&\\\" @#%\\*\\{}\\(\\)_\\+\\.\\s=-]{1,1000}$

I know it\'s ugly,

6条回答
  •  -上瘾入骨i
    2020-11-22 10:03

    This solution fixed my problem while replacing br tag to '\n' .

    alert(content.replace(//g,'\n'));
    

提交回复
热议问题