in most cases, we can avoid temporary variables. 
This: 

    func ranges(input: String) -> [NSRange]? {
        let matches = self.internalExpression.matchesInString(input, options: nil, range: NSMakeRange(0, count(input)))
        var results: [NSRange] = []
        for match in matches {
            let matchRange = match.range
            results.append(match.range!)
        }
        return results
    }

turned to: 

    func ranges(input: String) -> [NSRange] {

        let matches = self.internalExpression.matchesInString(input, options: nil, range: NSMakeRange(0, count(input)))

        return matches.map({ $0.range })

    }