find . -regex '.*\.\([chCH]\|cc\|CC\)'
will find all files with names ending in .c, .C, .h, .H, .cc and .CC and will not find them in .hc, .cC or .Cc. In a regular expression, the first few characters correspond to the last period in the name, and alternatives in brackets correspond to any of the single characters c, h, C or H or cc or CC.
Note. Finding -regex and -iregex switches is similar to -name and -iname , but regular expression type switches allow you to use regular expressions with | for alternate matches. Like -iname , -iregex not -iregex .
(non-functional) form
find . -name '*.[cCHh][cC]?$'
given in the previous answer does not contain any names on my Linux system with GNU find 4.4.2. Another problem with '*.[cCHh][cC]?$' As a regular expression is that it will match names like abc.Cc and xyz.hc that are not part of the .c, .C, file set. h, .H, .cc and .CC that you want.
source share