find -E . -type f -iregex ".*Diss.*\.tex" -exec basename {} +
or
find -E . -type f -iregex "(.*/).*Diss.*\.tex" -exec basename {} +
finds ALL files with extension .tex
, but does not limit their names to Diss*.tex
Is it OSX malfunctioning, or is the regex wrong?
The .*
pattern matches any 0 or more chars, hence the Myfile
may appear in any part of the path. See your regex demo:
You may restrict the Myfile
to only appear after the last /
if you replace those .*
at the end with [^/]*
matching any 0+ chars other than /
.
The pattern will look like
.*/[^/]*Myfile[^/]*\.tex
Here is a demo of what it will match.