Say, is it possible to use the campaign script to automatically replace units in cities?

For example: in each city, replace all Polybian Hastati units having experience 2 or greater with a Polybian Principes unit ?