Re: reverse find
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: reverse find
- From: PA <petite.abeille@...>
- Date: 2006年1月26日 19:41:11 +0100
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/