Extract file extension: Difference between revisions

Content added Content deleted
(→‎{{header|Perl 6}}: use the new test-cases, and compare output to the built-in .extension method)
(→‎{{header|Perl 6}}: restrict to ASCII letters and numbers)
Line 812: Line 812:


<lang perl6>sub extension (Str $path --> Str) {
<lang perl6>sub extension (Str $path --> Str) {
$path.match(/:i ['.' <+alpha-[_]>+]? $ /).Str
$path.match(/:i ['.' <[a..z0..9]>+]? $ /).Str
}</lang>
}</lang>