lua-users home
lua-l archive

Re: reverse find

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Jan 25, 2006, at 20:38, Torsten Karwoth wrote:
=string.match("another.filename.with.extension.as.extension","^.*(%..*) $")
What about file names which start with ".", but don't have an extension (e.g. ".svn", ".DS_Store", etc )?
What would be a good pattern to avoid those?
Right now, I break the file path into its components and check the last one with something like this:
print( ( ".csv" ):match( "^.+%.(%w+)$" ) )
> nil
print( ( ".csv.txt" ):match( "^.+%.(%w+)$" ) )
> txt
Better alternatives?
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/

AltStyle によって変換されたページ (->オリジナル) /