--nextPart2605295.gElL4nP51I
Content-Type: text/plain;
charset s-ascii"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hello all,
I want to split a filename into it's root and extension, ie:
someFileName.txt = 'someFileName' and 'txt'
This is simple enough with string.split(), but what if the file has more than
one period in it? I have worked around this by doing:
filename = "some.file.name.txt"
temp = filename.split(".")
type = temp.pop
fileroot = temp.join(".")
I was wondering though if instead of the temp variable I could just do:
fileroot, type = filename.split(/regex here?/)
I cannot find a way to write a regex that only matches the last period in the
filename. Is there an elegant way to do this?
Thanks,
-d
--
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972
--nextPart2605295.gElL4nP51I
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
iD8DBQBEhiwswPD5Cr/3CJgRAlCfAKDOaBUi+UivxWqNSDDexyPWKnw/HgCg2p98
hr7DXjqJVlTH/0xbp/vWDccyE
-----END PGP SIGNATURE-----
--nextPart2605295.gElL4nP51I--