Generic readhandler

Seems like this regex could simply be reused with `allowedExtensions.join('|')` as the input for the match.