I’m having trouble using the regex of the find command. Probably something I don’t understand about escaping on the command line.
Why are these not the same?
find -regex '.*[1234567890]'
find -regex '.*[[:digit:]]'
Bash, Ubuntu
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Regular expressions with character classes (e.g.
[[:digit:]]) are not supported in the default regular expression syntax used byfind. You need to specify a different regex type such asposix-extendedin order to use them.Take a look at GNU Find’s Regular Expression documentation which shows you all the regex types and what they support.