tested and modified regex for more generality