in reply to Re: Regex to detect file name
in thread Regex to detect file name

# corrected if($view_tag =~ m/^[A-Za-z0-9][\w.-]*/) {
I think that you need to add an end-of-string anchor at the end of the pattern to prevent matching if there are some unwanted or spurious characters after the last character matching [\w.-].