public static OperationOutcome ValidatePattern(this Validator v, ElementDefinition definition, ITypedElement instance) { var outcome = new OperationOutcome(); if (definition.Pattern != null) { ITypedElement patternValueNav = definition.Pattern.ToTypedElement(); if (!instance.Matches(patternValueNav)) { v.Trace(outcome, $"Value does not match pattern '{toReadable(definition.Pattern)}'", Issue.CONTENT_DOES_NOT_MATCH_PATTERN_VALUE, instance); } } return(outcome); }