From: Matt Kettler <mkettler...@verizon.net> Date: Thu, 16 Jul 2009 08:52:50 -0400 twofers wrote: > How can I pattern match when every word has an underscore after it. > Example: > This_sentenance_has_an_underscore_after_every_word > > I'm not really good at Perl pattern matching, but \w and \W see an > underscore as a word character, so I'm just not sure what might work. > > body =~ /^([a-z]+_+)+/i > > Is that something that will work effectively?
Is this for a spam rule? I'd do something like this: body MY_UNDERSCORES /\S+_+\S+_+\S+/ Unless you really want to restrict it to A-Z. Regardless, ending any regex in + in a SA rule is redundant. Since + allows a one-instance match, it will devolve to that. You don't need to match the entire line with your rule, so the extra matches are redundant. It will match the first instance, and that's all it needs to be a match. Also any regex ending in * should just have it's last element removed, as that will devolve to a zero-count match. The /\S+_+\S+_+\S+/ rule will lots of technical email, for example discussions on shell environment variables like LD_LIBRARY_PATH. -jeff