regexPattern

open val regexPattern: String? = null

The reason why this is a String and not a Regex is that it is easy to make the 'mistake' of creating a new Regex for every object, which is inefficient (both for CPU and RAM). E.g. this would be bad as a new Regex object would be created for each model:

class Email(value: String) : StringContainer(value) {
override val validRegexPattern = Regex("^(.+)@(\\S+)$")
}