Test, validate and match regular expressions
Validates uploaded file names by requiring the base name to start and end with an alphanumeric character, allowing letters, digits, spaces, underscores, and hyphens in between, followed by a dot and a non-empty extension of alphanumeric, underscore, or hyphen characters. This rejects names with leading/trailing spaces, missing extensions, or invalid characters before the dot. The global and multiline flags enable validating multiple file names, one per line.