Why didn't this blacklist work?

I’m having issues with blacklist and with the whitelist for url. These seem straightforward but yet they don’t seem to work properly for me.

You can see that I blocked “dot*com” in the blacklist to block this particular spam message getting around my URL filter. But you can see that it didn’t prevent the message.

https://imgur.com/a/oQ2Re1s

I don’t know if it’s related but it also times out users for posting YouTube links, even though this is my whitelist. What am I missing?

Did the spam message you had, maybe have 2 spaces ? Unless * cannot be used for spaces. Not sure on that.

Hey @kaiyotech!

I believe the wildcard character (*) only works when it’s at the end of a word, if you want to match what was sent in your chat, using “dot com” would have worked.

If you’re familiar with RegExp you can create more advanced filters.

Had a look at the advanced filters page and it’s not saying a lot about REGEX.
Which syntax does it use please (as there are a few slightly different ones).

Many thanks :slight_smile:

~/[pattern]/[flags]

For help on the pattern and eventual flags/modifiers see the RegExp link above.

The only modifier you might need is “i” for case-insensitive matches, the others are a bit useless in our context.

For the pattern you do it like usual, so if you want to match “dot com” and “dotcom” for example, the pattern will be: /dot\s?com/, then for Nightbot to work with it you just need to add a tilde (~) before the pattern: ~/dot\s?com/, and if you want it to match “DOT COM” as well as “DOTCOM” too, you can add the “i” modifier: ~/dot\s?com/i

As far as I can see, this may work for you…

~/dot[\s,.-_]+com/

Yep, that said, if you want to account for any character(s) that could be placed between the “dot” and “com” (including the lack of one), you can do the simpler: ~/dot.*com/i

I deleted this message as I was talking C**P :smiley: :smiley:

Thanks. Didn’t realize the wildcard could only go at the end. I’m pretty good with regex so I’ll just do that, much easier. Thanks

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.