# RegExp in events

{% tabs %}
{% tab title="TypeScript" %}
```typescript
import { IContext } from 'degreet-telegram/src/types'

bot.on(
  /action_(.*)/,
  async (ctx: IContext): Promise<void> => {
    try {
      const action: string = ctx.matchParams[1]
      await ctx.answer.send(action)
    } catch (e: any) {
      console.error(e)
    }
  }
)
```
{% endtab %}

{% tab title="JavaScript" %}
```javascript
bot.on(/action_(.*)/, async (ctx) => {
  try {
    const action = ctx.matchParams[1]
    await ctx.answer.send(action)
  } catch (e) {
    console.error(e)
  }
})
```
{% endtab %}
{% endtabs %}
