diff --git a/core/enforcer-rules/src/main/groovy/enforcer/rules/AbstractPropertyEnforcerRule.groovy b/core/enforcer-rules/src/main/groovy/enforcer/rules/AbstractPropertyEnforcerRule.groovy index f8b9b47..2a7c09d 100644 --- a/core/enforcer-rules/src/main/groovy/enforcer/rules/AbstractPropertyEnforcerRule.groovy +++ b/core/enforcer-rules/src/main/groovy/enforcer/rules/AbstractPropertyEnforcerRule.groovy @@ -55,8 +55,12 @@ abstract class AbstractPropertyEnforcerRule extends AbstractStandardEnforcerRule if (regex.present && !propValue.toString().matches(regex.get())) { if (!regexMessage.present) { - regexMessage.set(getName() + ' "' + getPropertyName() + - '" does not match the regular expression "' + regex.get() + '".') + if (!message.present) { + regexMessage.set(getName() + ' "' + getPropertyName() + + '" does not match the regular expression "' + regex.get() + '".') + } else { + regexMessage.set(message.get()) + } } if (displayValue.get()) { regexMessage.set(regexMessage.get() + ' Value is "' + propValue + '".')