working with reg exp segments