Re: Regex and bad words

2006-05-06 Thread SkyBlueshoes
Richard Bagshaw wrote: Howdi, This one got me thinking, you could just match on something as simple as /ass/gi but as you say this would also flag up "harassment" etc, the only way I can see of doing this is either have a big list, or only allow words through that have a-z characters on both

Re: Regex and bad words

2006-05-06 Thread Randal L. Schwartz
> "Sky" == Sky Blueshoes <[EMAIL PROTECTED]> writes: Sky> I've been trying to develop some regex's to match bad words. Use Regexp::Common; if ($input =~ /$RE{profanity}/) { warn "naughty, naughty!" } -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 http://www

Re: Regex and bad words

2006-05-06 Thread Dr.Ruud
Richard Bagshaw schreef: > @words = $sentance =~ m/[A-Za-z]+/gi; Because of the /i, you don't need to mention the capitals. Alternatives: @words = ($sentence =~ m/\S+/g); @words = split ' ', $sentence; @words = ($sentence =~ m/[[:alpha:]]+/g); @words = split /[^[:alpha:]]+/, $senten

Re: Regex and bad words

2006-05-06 Thread Richard Bagshaw
Howdi, This one got me thinking, you could just match on something as simple as /ass/gi but as you say this would also flag up "harassment" etc, the only way I can see of doing this is either have a big list, or only allow words through that have a-z characters on both sides of the word. So

Re: Regex and bad words

2006-05-06 Thread SkyBlueshoes
Charles K. Clarkson wrote: Sky Blueshoes wrote: : I've been trying to develop some regex's to match bad words. : Just comparing against a list of bad words doesn't work that : well, because I would have to include every possible use of : a curseword, ie: bullshit, shit, shithead, etc. Oh cr

RE: Regex and bad words

2006-05-05 Thread Charles K. Clarkson
Sky Blueshoes wrote: : I've been trying to develop some regex's to match bad words. : Just comparing against a list of bad words doesn't work that : well, because I would have to include every possible use of : a curseword, ie: bullshit, shit, shithead, etc. Oh crap! Those are bad words? I th