Created
October 4, 2012 04:52
-
-
Save rwz/3831542 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
str = "some file name.with dots.html.markdown" | |
extensions = str[/(?:\.\w+)+$/] | |
extensions ? [ str.sub(extensions, ''), extensions[1..-1].split('.') ] : [ str ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works with
"a.b c.a"
as well, producing["a.b c", ["a"]]