Quick string matching help

I have string:

“/dira/dirb/file.txt”

I want to get the file name as a separate string. I found the following:

string.gsub("/dira/dirb/file.txt","(.*)/", function(a) print(a) end )

but this gives me “/dira/dirb/” - I want file.txt

I’m sure there’s an easy way to do this.

[import]uid: 31718 topic_id: 6752 reply_id: 306752[/import]

don’t use gsub, use gmatch:
http://developer.anscamobile.com/forum/2011/02/16/string-strings [import]uid: 12108 topic_id: 6752 reply_id: 23679[/import]