Replacement for regex_replace function in older sql version

Problem: I am looking for ways in which I can use a replacement for regex_replace function in my sql query as I am using 5.7 version.

Aim: I have created a java class which does the following:

  1. Creates connection to the db.
  2. Creates an update query using regex_replace which masks the column value as: -> value: name=xyz|department=office|number=123456 to newvalue: name=xyz|department=office|number=XXXX56
  3. Executes the query on millions of record in batches of few thousand rows.

Now, I tried running the same on sql 5.7 version but it says regex_replace function not found. Can someone suggest an easy way that I need to change in the java code to handle any new implementation of regex_replace function. If I need to use any stored sql procedures I am not sure what changes I need to make in the code. Please provide a simpler way to use and be able to run the update query.

Can anyone help me on this ?

This is a microsoft sql server forum. Not a mySql forum.