New function to get filename extension.
For extensions, chop off all characters at the first char that is not alphanumeric (or underscore). The situation does happen, e.g. for files named from URIs.
Added underscore to regexpression to allow it in extensions.
Merge pull request #295 from SynapticNulship/extfunc

New function to get filename extension.