Ugh! The plot thickens:
mysql> SELECT REGEXP_REPLACE('abcd', 'c', '') = 'abd';
+-----------------------------------------+
| REGEXP_REPLACE('abcd', 'c', '') = 'abd' |
+-----------------------------------------+
| 1 |
+-----------------------------------------+
mysql> SELECT HEX(REGEXP_REPLACE('abcd', 'c', '')), HEX('abd');
+--------------------------------------+------------+
| HEX(REGEXP_REPLACE('abcd', 'c', '')) | HEX('abd') |
+--------------------------------------+------------+
| 610062006400 | 616264 |
+--------------------------------------+------------+
mysql> SELECT LENGTH(REGEXP_REPLACE('abcd', 'c', '')), LENGTH('abd');
+-----------------------------------------+---------------+
| LENGTH(REGEXP_REPLACE('abcd', 'c', '')) | LENGTH('abd') |
+-----------------------------------------+---------------+
| 6 | 3 |
+-----------------------------------------+---------------+
mysql> 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 )
REPLACEofCHAR(0)with''