About 308,000 results
Open links in new tab
  1. String.prototype.replace () - JavaScript | MDN

    Jul 10, 2025 · Global replace can only be done with a regular expression. In the following example, the regular expression includes the global and ignore case flags which permits replace() to replace each …

  2. JavaScript String replace () Method - W3Schools

    The replace() method does not change the original string. If you replace a value, only the first instance will be replaced. To replace all instances, use a regular expression with the g modifier set. Read …

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

  4. JavaScript Regex Replace

    Summary: in this tutorial, you’ll learn how to use the string replace () method to return a new string with some or all matches of a regular expression replaced by a replacement string.

  5. JavaScript String.Replace () Example with RegEx

    Oct 20, 2020 · To use RegEx, the first argument of replace will be replaced with regex syntax, for example /regex/. This syntax serves as a pattern where any parts of the string that match it will be …

  6. Replace Specific Words in a String Using Regular Expressions in JavaScript

    Jul 23, 2025 · In this article, we are going to learn about replacing specific words with another word in a string using regular expressions.

  7. How to Replace With Regex in JavaScript - Delft Stack

    Feb 2, 2024 · This tutorial takes you through step-by-step guide of JavaScript replace with regex.

  8. How do I replace all occurrences of a string? - Stack Overflow

    From the docs: “If searchValue is a string, replaces all occurrences of searchValue (as if .split(searchValue).join(replaceValue) or a global & properly-escaped regular expression had been …

  9. Search/replace with Regular expressions - javascript-tutorial.com

    As mentioned previously, the replace () method is case-sensitive when using simple strings as arguments, so to get us started using the regex version of this method, let me show you how we can …

  10. Regular expressions - JavaScript - MDN

    Jul 21, 2025 · In JavaScript, regular expressions are also objects. These patterns are used with the exec() and test() methods of RegExp, and with the match(), matchAll(), replace(), replaceAll(), …