About 4,220,000 results
Open links in new tab
  1. javascript - JS regex: replace all digits in string - Stack Overflow

    Apr 7, 2012 · s.replace(/\d/g, "X") which will replace all occurrences. The g means global match and thus will not stop matching after the first occurrence. Or to stay with your RegExp …

  2. Replace/Remove all Numbers in a String using JavaScript

    Mar 1, 2024 · Use the String.replace() method to replace or remove all numbers in a string, e.g. const replaced = str.replace(/[0-9]/g, '!');. The String.replace() method will return a new string …

  3. JavaScript String replaceAll() Method - W3Schools

    The replaceAll() method returns a new string with all values replaced. The replaceAll() method does not change the original string. The replaceAll() method was introduced in JavaScript 2021.

  4. JavaScript Replace All Numbers in a String - sebhastian

    Sep 26, 2023 · Today I’ll share a simple trick to replace all numbers from a string in JavaScript. All you need to do is to use the String replace() method and a regular expression to find all the …

  5. String.prototype.replaceAll() - JavaScript | MDN - MDN Web Docs

    Mar 13, 2025 · The replaceAll() method of String values returns a new string with all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the …

  6. Using Regex to Replace Numbers in a String - John Kavanagh

    1 day ago · So, to replace sets of numbers within a string, with their text equivalents, we just need to stitch everything together: Use replace() method; Use the /g flag and + quantifier to match …

  7. JavaScript String.Replace() Example with RegEx

    Oct 20, 2020 · With RegEx, you can match strings at points that match specific characters (for example, JavaScript) or patterns (for example, NumberStringSymbol - 3a&). The .replace …

  8. javascript - How to remove numbers from a string ... - Stack Overflow

    I want to remove numbers from a string: questionText = "1 ding ?" I want to replace the number 1 number and the question mark ?. It can be any number. I tried the following non-working code. …

  9. How to use replaceAll() with regex JavaScript? [SOLVED]

    Dec 6, 2022 · JavaScript provides an instance method called the replaceAll method which allows us to match patterns within a string and returns a new string with the replacement. If you need …

  10. JavaScript String replaceAll() method (with examples)

    Feb 14, 2024 · The replaceAll() method in JavaScript is a powerful tool for string manipulation, allowing developers to replace all occurrences of a substring within a given string with another …

  11. Some results have been removed
Refresh