

Filter anything with RegexieBot
A regex-based text filter for Telegram groups. Never speaks unless spoken to, no in-group ads and premium features.

Table of Contents
Introduction
RegexieBot is a powerful text filter for Telegram groups. If your group is suffering from particular words, sequences of characters, or you want to reply to some patterns, it’s for you. In some cases, it can be used to force users to follow a particular form in writing messages, e.g. to include hashtags at the beginning of messages.
We tried to make the bot as simple as possible: no premium accounts, referral programs, in-group ads and other distracting stuff everybody faces nowadays. It implements a so-called cost-plus pricing model: the more you spend, the more you pay. If you connect one or two groups you’re unlikely to pay at all.
@RegexieBot is the only instance at the moment, everything else is not us.
Energy
Bots, like any other programs, consume real energy resources. Each user has 1000⚡️ (virtual units of power) by default and can expend them as they wish. For some functions, consumption is calculated, for some it’s hardcoded.
Since Telegram doesn’t provide a method to block updates from certain groups, the bot consumes energy even when it’s inactive. We call it Passive Consumption, and it’s calculated using the formula:
passive_consumption = ((300 * member_count / (member_count + 1000)) + 100) * discussion_factor
where discussion_factor = 1
if a group is not linked to a channel, and discussion_factor = 1.25
if it is. member_count is updated once a day, but you can update it manually
Three main facts follow from the formula:
- The bigger a group is, the more it consumes
- Linked channels increase passive consumption by 25%
- Minimum passive consumption is 101, maximum one is about 500 (498, to be precise, for a discussion group, and 399 for a regular group, if we assume that maximum
member_count
is 200 000)
Let’s practice. Imagine a group of 5000 members that is not linked to a channel. We connect it to the bot, and ((300 * 5000 / (5000 + 1000)) + 100) * 1 = 350
⚡️ are subtracted from the reserve. Then we configure the bot and it shows that functions consume 50⚡️. Total: the group consumes 350⚡️ in the inactive state, and 350 + 50 = 400
⚡️ in the active state.
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 sets of rules and special options. A rule is just a pattern + action.
There are two modes of pattern creation. In simple mode, you send a list of strings and can switch some basic parameters like case insensitivity. But, many tasks cannot be solved by direct string matching, so you can use old good regular expressions, compatible with JS. https://regex101.com 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, as it can show different results for the same rule, some results can be weird, but we’re constantly working on its improvement. Try to experiment to find the best formula.
Separate filters were created in particular to lower consumption for most common text entities. For example, if you want to filter google.com, you don’t have to invent sth like /\b(https?:\/\/)?(.+.)?google.com(\/.+)?\b/
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.