@scribu, I looked at http://plugins.svn.wordpress.org/, and some plugins have complex slugs (folder names) including non alphanumeric characters.

My new approach in b26cade should work ok I think.