Added regex constraint, fixed implementation for other constraints.