public PatternReplacerImpl(Map<AttributeKey, Object> attributes) {
        super(attributes);
        if (attributes.get(AttributeKey.FROM_PATTERN) == null) {
            throw new FileRenamerException("The " + AttributeKey.FROM_PATTERN + " can't be found");
        }
        if (attributes.get(AttributeKey.TO_PATTERN) == null) {
            throw new FileRenamerException("The " + AttributeKey.TO_PATTERN + " can't be found");
        }
        if (attributes.get(AttributeKey.IGNORE_EXTENSION) != null) {
            extensionIgnored = (Boolean) attributes.get(AttributeKey.IGNORE_EXTENSION);
        }
        if (attributes.get(AttributeKey.TURN_ON_REGEX) != null) {
            turnOnRegex = (Boolean) attributes.get(AttributeKey.TURN_ON_REGEX);
        }
        fromPattern = (String) attributes.get(AttributeKey.FROM_PATTERN);
        if (!turnOnRegex) {
            if (!FileNameUtils.isValidFileName(fromPattern)) {
                throw new InvalidFileNameException(
                        "A file name can't contain any of these \\/:*?\"<>| characters");
            }
        }
        toPattern = (String) attributes.get(AttributeKey.TO_PATTERN);
        if (!FileNameUtils.isValidFileName(toPattern)) {
            throw new InvalidFileNameException(
                    "A file name can't contain any of these \\/:*?\"<>| characters");
        }
        if (!turnOnRegex) {
            fromPattern = RegexEscapeUtils.escapeRegex(fromPattern);
        }
    }