modified regex since it didn't work in script mode