Its about to find filename and after that so find some matching string
var imgurl = "http://domain.com/wp-content/uploads/2012/10/DSC_2355-515x440.test.jpg";
var filename = /.*(?=\.)/.exec(imgurl.match(/.*\/(.*)$/)[1]);
if( filename.indexOf( "515x" ) !== -1 ) {
alert("found!")
}
$("body").append(filename);
When i use filename.indexOf( "515x" ) so it doesn’t work
But it work when i use imgurl.indexOf( "515x" )
What i did wrong ?
Test the code here : http://jsfiddle.net/YkXTs/
Try this: http://jsfiddle.net/KQ4Kn/
This will fit the need
filename.toString().indexOf("515x"):)Code