UP’s Regex Assignment plugin can assist you with automatically validating a file submission based on its content and filename. To use:
Create a Moodle Assignment in your course. If you need help creating an Assignment please see the Moodle Guide on assignments.
In the Assignment settings, make sure that File submissions is selected and that the Maximum number of allowed files is 1. Then tick the box for File Regex validation
Use the File name Regex field to validate submission file names. Leave this empty if you don’t want to validate the filename.
Note: If you just want to ensure students are submitting a particular type of file (such as a PDF, .docx, etc) you may find it easier to use the Accepted File Type option in the Moodle assignment settings.
Use the Content regex to validate the contents of a text file. You can use the expression to ensure students submit a file that has content that matches or does not match your expression.
If you need additional Content fields, you can add them with the Add fields button.
University of Portland faculty can access Lynda.com for in-depth learning about using regular expressions.