Add an exception (with RegExp)

Hello.
I have banned the use of other languages using RegExp
Adding expressions like /[\u0080-\u00FF]+ to the blacklist.
But I met a problem. It consists in the fact that some characters are used in all languages. For example, ° - when a person tells what the weather is like. Or other characters that are included in the forbidden block.
My question is: Is it possible to make exceptions?
For example /[\u0080-\u00FF]+ is forbidden, but U00B0, U00F7 and U01C3 are allowed
How do I write this?

Have you considered using the ^ not operator to match to only the language you want and selected characters like this?

/[^\x00-\x7F\u00B0\u00F7\u01C3]/g

This bans all non English characters except the three you listed I’m presuming you want only English but feel free to make it however you want.

1 Like

Yes, I considered it, but it didn’t suit me.
This is where we discussed it

Ok try this:

/(?=[^\u00B0\u00F7\u01C3])[\u0080-\u00FF]/

However as a side note you don’t really need to include the \u01C3 as that’s not within the range of the set.

1 Like

You can use the Public Unicode Character Map to find the sets you wish to allow, for example ° is in Latin-1 Supplement.

2 Likes

I know that. I have a difficulty with the correct formulation of the formula

I checked it out. It doesn’t work at all.
I need certain characters from the table to be allowed in the chat. In this case, but the entire block should be blocked.

Try the code above again I got rid of the + at the end that should work now from my testing.

1 Like

The new version doesn’t work either

Really is it banning the symbols or not banning them at all?

1 Like

does not prohibit at all. The nightbot does not see this command

Can you show me what your typing in chat?

1 Like


Just watch the chat
Symbols ° Ë ë must be allowed, other characters are prohibited
The bot gives a message every minute.

Yeah that’s weird from my testing with a regex checker it worked I’ll look more in depth into it later when I can with nightbot.

1 Like

No one has a solution?
There is a ban on /[\u0080-\u00FF]+/
Need to allow the characters in this block u00B0, u00CB and u00EB
How to do it?

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