     public func trim() -> String {
         return self.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
     }
+    
 }

        do {
            let exp = try NSRegularExpression(pattern: regex, options: options)
            let nsString = self as NSString
            let results = exp.matches(in: self, options: [], range: NSMakeRange(0, self.length))
            return results.map{nsString.substring(with: $0.range)}
        } catch {
            return []

    
    public subscript(r: Range<Int>) -> String {
        let startIndex = self.characters.index(self.startIndex, offsetBy: max(0, r.lowerBound))
        let endIndex = self.characters.index(self.startIndex, offsetBy: min(self.count, r.upperBound))
        return String(self[startIndex..<endIndex])
    }
    
