Regex replace with empty string results in NULL characters in between Replacing a character with regexp_replace results in NUL characters in between.

SELECT REGEXP_REPLACE(aColumn,'c', '')
INTO OUTFILE 'Replaced.csv';


for abcd results in:

ab d (infact: abNULd)


This does not occur with just REPLACE  

using MySQL 8
Ugh!  The plot thickens:

mysql&gt; SELECT REGEXP_REPLACE('abcd', 'c', '') = 'abd';
+-----------------------------------------+
| REGEXP_REPLACE('abcd', 'c', '') = 'abd' |
+-----------------------------------------+
|                                       1 |
+-----------------------------------------+

mysql&gt; SELECT HEX(REGEXP_REPLACE('abcd', 'c', '')), HEX('abd');
+--------------------------------------+------------+
| HEX(REGEXP_REPLACE('abcd', 'c', '')) | HEX('abd') |
+--------------------------------------+------------+
| 610062006400                         | 616264     |
+--------------------------------------+------------+

mysql&gt; SELECT LENGTH(REGEXP_REPLACE('abcd', 'c', '')), LENGTH('abd');
+-----------------------------------------+---------------+
| LENGTH(REGEXP_REPLACE('abcd', 'c', '')) | LENGTH('abd') |
+-----------------------------------------+---------------+
|                                       6 |             3 |
+-----------------------------------------+---------------+

mysql&gt; SELECT @@version;
+-----------+
| @@version |
+-----------+
| 8.0.15    |
+-----------+


Looks like there are NULs all over!  And looks like they are ignored--somewhat!

I filed http://bugs.mysql.com/94203

MariaDB 10.3.11 "does the right thing"  ( 1 / no NULs / 3,3 )