```sql
SELECT replaceRegexpAll('a', 'z*', '')
```

```
┌─replaceRegexpAll('a', 'z*', '')─┐
│                                 │
└─────────────────────────────────┘
```

```sql
SELECT replaceRegexpAll('aaaa', 'z*', '')
```

```
┌─replaceRegexpAll('aaaa', 'z*', '')─┐
│ aaa                                │
└────────────────────────────────────┘
```

Please create another issue.

_Originally posted by @alexey-milovidov in https://github.com/ClickHouse/ClickHouse/issues/35046#issuecomment-1061220789_
#pragma once
#include <base/types.h>
#include <Common/Volnitsky.h>
#include <Columns/ColumnString.h>
#include <IO/WriteHelpers.h>
#include "config_functions.h"
#include <Common/config.h>
#include <re2_st/re2.h>
namespace DB
{
namespace ErrorCodes
{
    extern const int BAD_ARGUMENTS;
}
/** Replace all matches of regexp 'needle' to string 'replacement'. 'needle' and 'replacement' are constants.
  * 'replacement' could contain substitutions, for example: '\2-\3-\1'
  */
template <bool replace_one = false>
struct ReplaceRegexpImpl
{
    
    struct Instruction
    {
        
        int substitution_num = -1;
        
        std::string literal;
        Instruction(int substitution_num_) : substitution_num(substitution_num_) {}