class PatternExtractor {

    public List<ReplacingPattern> getPatternsFromString(String pattern) throws MailetException {
        String trimPattern = pattern.trim();
        assertPatternSurroundedWithSlashes(trimPattern);
        
        ImmutableList.Builder<ReplacingPattern> patternList = ImmutableList.builder();
        for (String aPatternArray : extractPatternParts(trimPattern)) {
            patternList.add(stripSurroundingSlashes(aPatternArray));
        }
        return patternList.build();
    }

}