Pages

Wednesday, July 27, 2011

Regular expression to remove all numbers from a string

This is in continuation to my previous post where I posted the code to remove characters that are not digits. This case is vice versa.

var pattern=/\d/g;
var myString="80AlphaDog55";
alert(myString.replace(pattern,""));

The result is AlphaDog

hope this helps :)

No comments:

Post a Comment