try using a regex and matching ([^\]+$) I'm not up on my \ escaping for javascript, so you may need a different number of \'s in there to make it work
Tombo wrote: > this might not be jquery related, but i noticed there are a lot of savvy > javascript programmers in this mailing list. > > i want to grab just the filename and extension from the following string: > > str1="F:\\Test1\\Test2\\Test3\\test.txt"; > > i want to grab "test.txt" > > i use this code: > > file1=(str1.split("\\"))[(str1.split("\\")).length-1]; > > > i was wondering if there is a better way to grab that part of the string > > Thx for any help > _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/