About 16,900,000 results
Open links in new tab
  1. javascript - How do I replace all occurrences of a string ... - Stack ...

    Given a string: string = "Test abc test test abc test test test abc test test abc"; This seems to only remove the first occurrence of abc in the string above: string = string.replace('ab...

  2. JavaScript String replace vs replaceAll - Stack Overflow

    Apr 28, 2021 · ECMAScript 2021 has added a new String function replaceAll. A long time ago in a galaxy not so far away, people used split + join or regular expressions to replace all …

  3. How can I perform a str_replace in JavaScript, replacing text in ...

    I want to use str_replace or its similar alternative to replace some text in JavaScript.

  4. How to replace part of a string using regex - Stack Overflow

    Apr 28, 2017 · 25 i need to replace a part of a string in Javascript The following example should clarify what i mean

  5. How to replace " with \" in javascript - Stack Overflow

    JavaScript doesn't take the value of your textbox and try to put it in quotes. If you text box has "" entered into it, document.getElementById('mytextbox').value is not equal to "\"\"". The …

  6. javascript - Replace multiple characters in one replace call - Stack ...

    160 If you want to replace multiple characters you can call the String.prototype.replace() with the replacement argument being a function that gets called for each match. All you need is an …

  7. javascript replace() is not replacing all the characters match

    Aug 7, 2013 · I repeatedly found that the default behavior of "replace" is almost useless and dangerous. Why would I want to replace the first occurrence only (in a general case) ? why not …

  8. javascript - Fastest method to replace all instances of a character …

    Jan 22, 2010 · What is the fastest way to replace all instances of a string/character in a string in JavaScript? A while, a for-loop, a regular expression?

  9. JavaScript: replace last occurrence of text in a string

    Apr 28, 2010 · I want to replace the last occurrence of the word one with the word finish in the string, what I have will not work because the replace method will only replace the first …

  10. javascript - replace dash (hyphen) with a space - Stack Overflow

    Imagine you end up with double dashes, and want to replace them with a single character and not doubles of the replace character. You can just use array split and array filter and array join.