Refactored PatternValueUtils.