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

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

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

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

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

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

  7. How to replace substring in Javascript? - Stack Overflow

    Nov 27, 2016 · 3 replace only replace the first occurrence of the substring. Use replaceAll to replace all the occurrence.

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

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

  10. 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 occurrence of it.