Skip to content

Instantly share code, notes, and snippets.

@lbvf50mobile
Last active August 15, 2020 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lbvf50mobile/efcf94706829cc0d5b21a4c3a079d62f to your computer and use it in GitHub Desktop.
Save lbvf50mobile/efcf94706829cc0d5b21a4c3a079d62f to your computer and use it in GitHub Desktop.
Just PHP FUN 077.
<?php
# https://www.codewars.com/kata/597770e98b4b340e5b000071 extract file name.
function fileNameExtractor(string $dirtyFileName): string {
$rgx = '/^([0-9]+_)*(([a-z0-9_-]+)(\.[a-z0-9_-]+))/i';
preg_match($rgx,$dirtyFileName,$matches);
return $matches[2];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment