Problem using NSRange: Index out of bounds
问题 I am trying to detect website URL's in my string and then doing some attribution string stuff like bolding it etc. My regex is defined as: static NSRegularExpression *websiteRegularExpression; static inline NSRegularExpression * WebsiteRegularExpression() { if (!websiteRegularExpression) { websiteRegularExpression = [[NSRegularExpression alloc] initWithPattern:@"\b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|]" options:NSRegularExpressionCaseInsensitive error:nil]; } return