var rex:RegExp = /[\s\r\n]*/gim; var str:String = "This is a string.";  str = str.replace(rex,'');