On Mon, 17 Jan 2005 16:04:48 -0500, Dave Gray <[EMAIL PROTECTED]> wrote: > > I am new to perl, I receive some spam email with subject like "st0ck, > > 0pportunities, gr0wth...", how can I match those words with number "0" in
What about something like this: if ( $subject =~ /(^0[a-zA-Z]+)|([a-zA-Z]+0$)|([a-zA-Z]+0[a-zA-Z]+)/ ) { ...it's spam, so do something... } Basically it says if a "word" starts with 0, has 0 in the middle, or ends in 0, it matches. These won't match: "Perl Problem" "0 compile errors, yay!" "I have 20 dollars that says..." "Forcast for Q1 2005" "$0 sale" These will: "Great 0pportunity for you!" "Buy this st0ck!" "N0 money down!" Not sure exactly how you're wanting to use this, but you could use a similar expression to replace the "0" in spam messages to "o" *before* it gets to your spam filter, or just use it to as is to filter out stuff that makes it past your spam filter. -- http://xstonedogx.heroesmarket.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>