title: REGEXP_REPLACE with DISTINCT
body: <p>I am trying to use distinct with REGEXP_REPLACE and 0 rows are returned.</p>
  
  <p>I've created a test table in MySQLP v8.0</p>
  
  <pre><code>   CREATE TABLE phone(
     id serial primary key,
     phone_number char(25));
  
     INSERT INTO phone (phone_number)
     VALUES ('(423) 330-9999');
  
     INSERT INTO phone (phone_number)
     VALUES ('(423)3309999');
  
     INSERT INTO phone (phone_number)
     VALUES ('423-330-1111)');
  
     INSERT INTO phone (phone_number)
     VALUES ('1-423-330-6666');
  
     INSERT INTO phone (phone_number)
     VALUES ('1A423*330*1111');
  
     INSERT INTO phone (phone_number)
     VALUES ('5553301111');
  </code></pre>
  
  <p>-- Then</p>
  
  <pre><code>select 
     REGEXP_REPLACE(phone_number, '[^0-9]', '',1, 0, 'm') as clean_phone
  from phone
  </code></pre>
  
  <p>--- works fine ->
  clean_phone
  4233309999
  4233309999
  4233301111
  14233306666
  14233301111
  5553301111</p>
  
  <p>--- count</p>
  
  <pre><code>select 
     count(REGEXP_REPLACE(phone_number, '[^0-9]', '',1, 0, 'm')) as 
     clean_phone
  from phone
  </code></pre>
  
  <p>--- works fine ->
  clean_phone
  6</p>
  
  <p>-- distinct clean_phone</p>
  
  <pre><code>select 
     distinct(REGEXP_REPLACE(phone_number, '[^0-9]', '',1, 0, 'm')) as 
     clean_phone
  from phone
  </code></pre>
  
  <p>--- returns empty ->
  clean_phone</p>
  
  <p>I don't understand why distinct doesn't work?</p>