About 7,290,000 results
Open links in new tab
  1. JavaScript String replace() Method - W3Schools

    The replace() method searches a string for a value or a regular expression. The replace() method returns a new string with the value(s) replaced. The replace() method does not change the original string.

  2. Replacing part of a string with javascript? - Stack Overflow

    Jun 22, 2009 · I've made it a varaible in my javascript but now I want to change "param2:set2" to be "param2:set5" or whatever. How do I grab that part of the string and change it? One thing to note is where "param2..." is in the string can change …

  3. How to replace a portion of strings with another value in JavaScript ...

    May 27, 2024 · We can replace a portion of String by using replace () method. JavaScript has an inbuilt method called replace which allows you to replace a part of a string with another string or regular expression. However, the original string will remain the same. Syntax:

  4. String.prototype.replace() - JavaScript | MDN - MDN Web Docs

    4 days ago · The replace() method of String values returns a new string with one, some, or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function called for each match.

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

    Apr 28, 2017 · You may use a regex that will match the first [....] followed with [and capture that part into a group (that you will be able to refer to via a backreference), and then match 1+ chars other than ] to replace them with your replacement:

  6. javascript - how to replace part of string with something else?

    Jan 11, 2017 · Use String.prototype.replace() - JavaScript | MDN. The replace() method returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match. I have assumed test as the different string in the code snippet below.

  7. JavaScript string replace() Method - GeeksforGeeks

    Jun 26, 2024 · JavaScript replace() method is used for manipulating strings. It allows you to search for a specific part of a string, called a substring, and then replace it with another substring. What’s great is that this method doesn’t alter the original string, making it ideal for tasks where you want to maintain the integrity of the original data.

  8. JavaScript Replace – How to Replace a String or Substring in JS

    Feb 28, 2023 · In JavaScript, you can use the replace() method to replace a string or substring in a string. The replace() method returns a new string with the replacement. The replace() method takes two arguments: The first argument is the string or regular expression to be replaced.

  9. JavaScript Program to Replace Characters of a String

    Jun 3, 2024 · In JavaScript, replacing a portion of strings with another value involves using the `replace()` method or regular expressions. This process is essential for text manipulation tasks like formatting, sanitization, or dynamic content generation in web development and data processing applications.

  10. JavaScript String replace() Method - JavaScript Tutorial

    In this tutorial, you'll how to use JavaScript String replace() function to replace a substring in a string with a new one.

  11. Some results have been removed
Refresh