Validate object constructor.

Closes #408.
Merge pull request #481 from jagoda/feat-regex

Validate object constructor.