improve regex functionality