             // Add all our ranges to the result
             for match in matches {
                 let matchRange = match.range
-                let stringIndexRange = text.startIndex.advancedBy(matchRange.location)..<text.startIndex.advancedBy(matchRange.location + matchRange.length)
-                let matchString = text.substringWithRange(stringIndexRange)
+                let matchString = NSString(string: text).substringWithRange(matchRange)
                 
-                rangesForLinkType.append(LinkRangeResult(linkDetectionType: linkType, linkRange: stringIndexRange, linkString: matchString, textLink: nil))
+                rangesForLinkType.append(LinkRangeResult(linkDetectionType: linkType, linkRange: matchRange, linkString: matchString, textLink: nil))
             }
         }
 

            }
            
            if let attributes = attributes {
                let location = text.startIndex.distanceTo(linkRangeResult.linkRange.startIndex)
                let length = linkRangeResult.linkRange.startIndex.distanceTo(linkRangeResult.linkRange.endIndex)
                let range = NSMakeRange(location, length)
                
                mutableAttributedString.setAttributes(attributes, range: range)
            }
        }
        

        for textLink in textLinks {
            let linkType = LinkDetectionType.TextLink
            let matchString = textLink.text
            let matchRange = NSString(string: text).rangeOfString(matchString)
            
            if matchRange.location < text.characters.count {
                rangesForLinkType.append(LinkRangeResult(linkDetectionType: linkType, linkRange: matchRange, linkString: matchString, textLink: textLink))
            }
        }
        
