Here is an example backup file I will be putting in preg_match to find. I am attempting to find the best regex to only grab these types of files. It needs to check for “backup” then the date (any date) then the time (any time) username and finish with .tar.gz
backup-12.9.2012_00-00-06_username.tar.gz
As of now, I have the following which works however I am looking for it to be more specific so I dont mistakenly pull something else.
preg_match('/backup-[0-9].*_username/', $file)
of course “username” will be a php variable when done
[0-9]is one digit..*is any sequence of characters.So
/backup-[0-9].*_username/will also match, for example,backup-1ABCD EFGH_usernameWhat you probably mean is
or, to be a bit more loose,