Remove simple javascript quotes

Asked

Viewed 5,206 times

2

I need to remove simple quotes from a string, I’ve tried string.replace(/\'/g, ''), .replace(/"'"/g, '') and it doesn’t work, someone can help me?

  • You can show an example of the string?

  • I see no problem with replace, probably not re-assigning, thus: string.replace(/\'/g, '') must be string = string.replace(/\'/g, ''), because replace itself does not alter the string.

  • It would be something like this: dataVencimento: '{$gte:ISODate("2017-11-09T02:00:00.000Z")}' Need to remove single quotes before {$gte and after )}

  • Your code works for this string... https://jsfiddle.net/Sergio_fiddle/jefwatnk/

1 answer

4


  • AP code works. I think the problem is another...

  • I tested both ways and the code suggested by @Everson worked, I really appreciate all your help

  • @Leonardoebert Thank you for the return and I’m glad you helped him ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.