Prior to MySQL 8.0.4, MySQL used the Henry Spencer implementation for REGEX and you could use this for word boundaries:
'[[:<:]]' and '[[:>:]]'
From 8.0.4 MySQL is using the ICU implementation and the word boundaries have changed to this:
'\\b'
I need to find out which REGEX implementation is used. Relying on MySQL version number might not be the best option as for example MariaDB has different version numbers.
I thought to check by querying MySQL and find out which implementation it's using like this:
"SELECT 1 FROM DUAL WHERE 'icu regex' REGEXP '\\bregex';"
This is working with MySQL 8.0.4 and previous versions. It will return 1 if the ICU implementation is used by the DB, 0 otherwise.
The opposite doesn't work instead as MySQL 8.0.4 throws an error:
"SELECT 1 FROM DUAL WHERE 'henry regex' REGEXP '[[:<:]]regex';"
Is there any better way to approach this?
MySQL reference about REGEX changes are here: https://dev.mysql.com/doc/refman/8.0/en/regexp.html#regexp-compatibility