Erm, it does work, acc. to my description (?)
It doesn't ban for "something.com" but for "www.something.com" or "http://something.com". If you want to ban just for "*.com" you wouldn't need a protocol check at all, and it would be a (lousy) badword script, so why not use a good badword script instead, there are many out there. The downside is that you'd e.g. ban for quoting your $server too.
The script above checks all lines in the textfile against $regml(N)*, where $regml(N) is the text following any occurrence of www/http/https/ftp up to the next space char, that is: a link indicated by a www-host and/or protocol, but without this part, to make matching more versatile.
- If I want to ban "www.google.com" or "http://google.com" or "http://www.google.com", I'd add "google.com"
- If I want to ban all google, I'd add "google." or even "*google"
- If I want to ban "<whatever>.com" I'd add "*.com"
Finally, there are more top-level domains under the sun than *.com *.net and *.org