I have a string str =/Users/user/Desktop/task/U6342_Account_20150112.txtI need return only U6342_Account_20150112 as an array ['U6342','Account','20150112']I did str.split('/')[-1].gsub('.txt','').split('_')which gives me ['U6342','Account','20150112']Is there any more convenient solution to do it?
Extracting components of a filename
strings;ruby