Showing posts with label regexp filename actionscript. Show all posts
Showing posts with label regexp filename actionscript. Show all posts

Friday, May 29, 2009

grab just the filename without the extension

var filename1: String = "monster.jpg";
var filename2: String = "big.fat.hippo.flv";

filename1 = filename1.replace( new RegExp( "(.*)\.(.*)", "g" ), "$1" );
filename2 = filename2.replace( new RegExp( "(.*)\.(.*)", "g" ), "$1" );

trace(filename1); //monster
trace(filename2); //big.fat.hippo