See post https://flaviocopes.com/how-to-replace-all-occurrences-string-javascript/
Regular expressions: https://flaviocopes.com/javascript-regular-expressions/
Get my book “The Developer’s Guide to Having a Successful Blog” https://flaviocopes.com/book/blog/
Original source
6 responses to “How to replace all occurrences of a string in JavaScript”
Oh many ty for this tut, really helped me out with my discord bot! <3
this doesn't work for replacing *, correct?
you is a GOD
Video interessanti, ma ho una domanda 🙂 che editor usi ?
Thank you, just one question. How to replace a word that sometimes is in the beginning of the sentence and it is capital. For example, "Hello from Italy, hello from Norway" How can I replace both "Hello" and "hello" to "hi" and keep the first hi Capital "Hi" ?
Grande Flavio! Buona fortuna per i tuoi corsi.