I looking into validating some file names. But cant figure out correct regex
file names can be anything, but need to check if filename ends with
my_file_dummy_name.jpeg - not valid
my_file_dummy_name_en.jpeg - valid
The problem with your original regex is that, while it would match the filenames you want to allow, it would also match things you don't want.
For example, the following regex
would match the file
my_file_dummy_name_de.mpeg, which is video file from Germany. Clearly, we wouldn't want to watch this in the first place.
Try this regex: