Hacker News new | ask | show | jobs
by kleiba 4673 days ago
If you want to check the various words in isolation, surrounding spaces might cost you some matches, e.g. at the end of a sentence ("It's a piece of shit.") or when followed by a comma. Also, did you ignore case ("Shit happens.")?

How about trying \b[Ss][Hh][Ii][Tt]\b and the likes?

1 comments

There were few enough curse words that I manually checked the output of not requiring spaces. Regarding the case sensitivity, it looks like I missed 12 instances of swearing because of that. Also, grep has a "-i" parameter, which makes it case insensitive.
Also a -w parameter, to match whole words only, which is generally better than adding spaces :)