Email Address

25 03 2008

var reg

= new

RegExp(‘^([a-zA-Z0-9_\\.\\-])+\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$’);

Advertisements




2 Decimal Floats

16 08 2007

var regex = new RegExp(‘^[0-9]+(\.[0-9]{0,2})?$’);





replaceAll String

14 08 2007

replace all commas with whitespace

var firstName ="John, Doe";
var formattedName= firstName.replace(/,/g,' ');