Pattern Constraints
Let’s learn about pattern constraints.
We'll cover the following
Pattern constraints in UML
A pattern constraint requires that a string attribute’s value must match a certain pattern, typically defined by a regular expression
. For instance, for the object type Book
we define an isbn
attribute with the datatype String
as its range. Then we add a pattern constraint requiring that the isbn
attribute value must be a 10-digit string, or a 9-digit string followed by “X” to the Book
class rectangle shown in the following diagram.
Get hands-on with 1400+ tech skills courses.