@dp.message_handler(regexp=r'^/search_\w+$')
@dp.message_handler(regexp=r'^/search_\w+$')
async def text(message: types.Message):
query = re.search(r'^/search_(\w+)$', message.text).group(1)
@bot.message_handler(commands=['search'])
def search(message):
if ' ' in message.text:
param = message.text.split(maxsplit=1)[1]
...
else:
bot.send_message(message.chat.id, 'no params')
/search XXX