----- Original Message ----- 
From: "James Keeline"
> --- Bob <[EMAIL PROTECTED]> wrote:
> 
>> Hi,
>> I'm trying to match 2 or more links.
>> 
>> <?php
>> $raw = "visit http://site.com and http://www.site.com for gifts!";
>> 
>> if (preg_match("/(http:){2,}/i", $raw)) echo "SPAM";
>> else echo "CLEAR";
>> ?>
>> 
>> The above doesn't work.
>> Where am I going wrong?
>> Thanks, Bob E.
> 
> I'm not exactly sure what you want to do here or how you can tell which URLs
> are good and which are spam.  However, the regex you have looks for two or 
> more
> copies of "http:" in sequence like
> 
> http:http:
> 
> Obviously, that won't do anything for your input text.
> 
> James

Hi James,
Thanks for explaining where I'd gone wrong.
Have amended it to preg_match("/(http:.+){5,}/i", $raw) which seems to work ok.

In reality, I want to ban any message that has more than 5 links in it.
Anyone posting 5 or more links is usually a spammer, and most have at least 10 
porn links in them.
In my message forum, very few links (if any) are posted, and usually only one 
at the most.

My spam filter already stops most of it, but occasionally, a batch of new links 
get through.
Regards, Bob E.


Reply via email to