Conditional statement regex fix and additional test cases