I'm both a regex & SE Unix and Linux newbie, so I hope I'm doing everything right.
I'm looking for files that have a name inside of the filename, and could have different extensions. I based my initial trials on this answer (the linux part) and my basic understanding of find and regexes, but with limited success.
I tried this regex:
.*filename[^/].*\.(jpg|xcf|png|jpeg), which inside
find looked like this
find . -iregex '.*filename.*\.\(jpg\|gif\|png\|jpeg\)$'.
The idea was to exclude the appearance of "filename" inside directory names, hence the "without forward slashes"
[^/] part of the regex, but it excludes the most basic (and necessary) format, e.g. filename.jpg
I also tried
find . -type f -iregex '.*filename.*\.\(jpg\|gif\|png\|jpeg\)$', but I have the feeling that using regexes might bypass the
-type flag, because I still get all the directories in my results.
Could you share some light?