I've never been able to get regular expressions in Cygwin to work for me.
Here's some background info:
-find (GNU findutils) 4.5.12
I have the following files in my directory:
-rw-rwxr--+ 1 None 0 Jun 4 19:16 eiooo.txt
-rw-rwxr--+ 1 None 0 Jun 4 19:20 g.py
-rwxrwx---+ 1 None 96 Jun 4 16:03 giibblejklxx_ekkwll.py
-rw-rwxr--+ 1 None 0 Jun 4 19:16 huuu.txt
-rw-rwxr--+ 1 None 20 Jun 4 19:17 more
-rw-rwxr--+ 1 None 0 Jun 4 19:20 v.py
I want to match strings whose ending is pys.
I try the following:
find -name "*py$"
and I get nothing.
I also try:
find -regex "*.py$"
and get nothing.
Am I using regular expressions correctly? It was my understanding that the "$" means "ends with". Is that true? I know that I could leave the dollar sign out in this case, but I want to practice different kinds of regular expressions, and "$" (and "^", actually) never seem to work with the find command.
Any suggestions? Thank.
-name
and -iname
use globs, not regular expressions. And -regex
and -iregex
will be false if the regular expression is invalid. Also note that -regex
and -iregex
attempt to match the entire path, not just the filename.