4 ms·
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
by kleiba 13y 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?
- gizmo686 13y agoThere 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.
- archangel_one 13y agoAlso a -w parameter, to match whole words only, which is generally better than adding spaces :)