Create alert on unusuall device name

I have configured a Postgres database and i’m able to pull the data from it. In that database i have a column named as ‘gw_id’, which in short is the name of the device. We have manually updated the device names with format of ‘mz1234’. Now if the device is reset, the device id goes to something like ‘mzXXXX’. I want to create an alert when such a device id is found in the data base.