Regex to remove apostrophe

前端 未结 7 621
野性不改
野性不改 2021-01-22 13:10

I have input text that contains a \' like in this text \"Frank\'s Reel Movie Reviews\"

how do I get rid of the \'

I have tried

.replace (/\\\'/ig         


        
7条回答
  •  星月不相逢
    2021-01-22 14:02

    If you just want to have letters and spaces in your result, you could always match any character that isn't one of those, such as...

    .replace (/[^a-zA-Z ]+/ig, '');
    

    You could of course also add any other characters you desired to permit to the regex.

提交回复
热议问题