A reader of Learning Unix for Mac OS X Panther writes in to ask for an explanation of the regular expression shown in this command:
du -s * .[^.]*
This regular expression is easily understood if you remember that to exclude a character from an expression you need to negate it with the ^, but to do that, you need to set off what you’re negating from the rest of the expression – the [ ] part.
So now you should be able to see that the expression matches all files or directories that begin with a dot but don’t have a dot as their second character, followed by zero or more characters.
In essence, this regular expression matches any dot files other than ‘..’.
If this seems overwhelming and you’re still quite interested in learning more about regular expressions, there’s a very good book from O’Reilly about regular expressions called Mastering Regular Expressions. It’s not poolside reading, but it’ll get you to the next level.