About 29,300,000 results
Open links in new tab
  1. How do I replace all occurrences of a string? - Stack Overflow

    Note: In general, extending the built-in prototypes in JavaScript is generally not recommended. I am providing as extensions on the String prototype simply for purposes of illustration, showing different …

  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 occurences of a …

  3. 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 object …

  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 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.

  6. JavaScript replace/regex - Stack Overflow

    Jul 22, 2009 · If you want to replace a literal string using the replace method, I think you can just pass a string instead of a regexp to replace. Otherwise, you'd have to escape any regexp special characters …

  7. 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 backslashes are only …

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

    Aug 7, 2013 · @MattBall In most languages, using replace lets you replace a string with a string, instead of needing a regex every time. the subject.split (search).join (replacement) construct is the closest …

  9. JavaScript replace() method dollar signs - Stack Overflow

    Aug 10, 2016 · 0 The replace method provides replacement patterns that start with a dollar sign. One of them is $$ which inserts a single $. A single dollar sign in the replacement string will result in a literal …

  10. How do I replace a character at a specific index in JavaScript?

    I have a string, let's say Hello world, and I need to replace the char at index 3. How can I replaced a char by specifying an index? var str = "hello world"; I need something like str.