I've got a regexp in a script I'm troubleshooting. To know what I need to keep and what I need to chuck, it will help if I understand what this regexp does.
The imgfile_name is an uploaded file.Code:preg_replace("/[^\da-z.]/i", "", $imgfile_name);
The goal is to take the filename and remove all the characters Microsoft allows in file names that will cause the file name to have issues when saved on a unix system. Ultimately, I'd like an elegant regexp that allows upper and lower case alpha, numbers and hyphen only. No underscore, no spaces, no #s or ? or tilde or brackets or other things I've seen people include.