Unit test for model.toObject and model.fromObject.
Adding a stored regex directly into the state element for faster running.