

Filter anything with RegexieBot
An advanced text filter for Telegram groups. Never speaks unless spoken to, no in-group ads and premium features.
Table of Contents
Introduction
RegexieBot is a regex-based filter for Telegram groups. It filters not only messages but also message entities and user names. It is mainly used to:
- detect particular words, domains, usernames, writing systems, emojis, any sequences of Unicode characters
- reply to commands or questions
- enforce a particular pattern in writing messages, e.g. to include certain hashtags at the beginning of messages or do not use more than two emojis
You cannot be afraid of premium subscriptions, referral programs, in-group ads and other unpleasant stuff everybody faces nowadays. It implements a fair monetization model and is free for most use cases.
@RegexieBot is the only instance at the moment, everything else is not us.
Energy ⚡️
Bots, like any other programs, use real energy resources. RegexieBot calculates its virtual energy (further – energy or ⚡️) usage using the formula:
energy_used = number_of_messages * (message_delivery_price + message_processing_price)
is the sum of prices of active rules, you can see it at the top of rules and filters. It’s calculated using a special algorithm when you create a rule.message_processing_price
message_delivery_price
is energy spent on message delivery from a Telegram server. Telegram doesn’t provide a way to block messages, so we push users to remove the bot from big groups if it’s no longer needed. At the moment, message_delivery_price = 10⚡️
— this is the minimum cost per message, even if the group is inactive.
RegexieBot gives each user 5M⚡️ at the beginning of every month, you can also buy additional energy that will be used if you run out of the free reserve. When your reserve is getting empty, your groups are deactivated. If they continue to drain lots of energy, the bot leaves them.
Let’s practice.
Imagine you have two groups and need to decide whether to buy additional energy, and if yes then how much you need. The bot shows total price of 62⚡️ for active groups, also you know that an approximate number of messages is 50K per month.
50K * 62 = 3.1M⚡️
— default energy should be enough. But, if the number of messages exceeds5M / 62 ≈ 80K
, the bot will be deactivated.Let’s say, your groups have increased and now you get 100K messages per month. You exceed the limit by
100K * 62 - 5M = 1.2M⚡️
. You can buy 2M⚡️for one month to have a ‘safety cushion’, the balance will be left for next months anyway
Rules and regular expressions
The bot can filter not only messages, but also names and some text entities. Thus, there are multiple text filters with their own built-in rules and special options. A rule is just a pattern + action.
There are two types of patterns — simple and regex. Simple pattern is a list of strings and basic parameters like case sensitivity. If your task is more complex you can use good old regular expressions, compatible with JS. regex101.com and various LLMs might be helpful in creating and testing regular expressions.
Consumption of each pattern is calculated using a special algorithm, the basis of which is benchmarking. The algorithm is far from being perfect, it may show different results for the same rule, but we’re working on its improvement. Try to experiment to find the best formula.
Entity filters were introduced in order to simplify pattern creation and lower consumption for most common text entities. For example, if you want to filter google.com, you don’t need to invent something like /\b(https?:\/\/)?(.+.)?google.com(\/.+)?\b/i
and spend a lot of energy on it. Telegram has already parsed the link, so just add /\bgoogle.com(\/|$)/i
to the special links filter. This regex isn’t perfect but simple and energy-efficient.