I was trying to find files in a certain directory which don't adhere to the naming guidelines for UNIX-like systems.
When using with find the command find <dir> -regex '.*[^-_./0-9a-zA-Z].*' returns the files of interest.
my question with above command line is:
- Why did we need the any one character metacharacter
.before the zero or more*metacharacter at the start and end of the regex respectively for this to work as intended. when i initially tried withfind <dir> -regex '*[^-_./0-9a-zA-Z]*'that returned nothing. - Furthermore, if I replace the
character rangesin the regex with their correspondingPOSIX character classeswith everything else intact:find <dir> -regex '.*[^-_./[:digit:][:lower:][:upper:]].*'it returns nothing. why is it this way?
TIA!