0

I want to replace everything in a string which is NOT a letter or number

For example:

str1='hello! its a beautiful day today12 21 '

My desired output is "helloitsabeautifuldaytoday1221"

I understand there would be many ways of doing this but I only looking for something small and efficient possibly little flexible

Snedden27
  • 1,870
  • 7
  • 32
  • 60
  • [*String.prototype.replace*](http://www.ecma-international.org/ecma-262/6.0/index.html#sec-string.prototype.replace) with a regular expression seems appropriate. What have you tried? What are your criteria for "best"? – RobG Oct 11 '15 at 22:51
  • 4
    `String str1 = '...'` This does not seem JavaScript – Oriol Oct 11 '15 at 22:52
  • Try https://www.google.com?q=javascript+replace+string. –  Oct 11 '15 at 23:11

0 Answers0