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
> "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
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
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
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
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