SebastienThiebaud/STTweetLabel — pull request #76 by wakachamo (2014-02-04 01:36:35+00:00)
Title: Regex-based URL detection, UILabel superclass awareness

## Changes
- URL detection is now based on a regular expression obtained from [John Gruber's blog post](http://daringfireball.net/2010/07/improved_regex_for_matching_urls), allowing the label to detect links with no protocol (.e.g ```"www.example.com"``` or even ```"bit.ly/something"```)
- Whenever the text is set, STTweetLabel now makes sure to ```[super setText:@""]```. This fixes a minor nitpick where STTweetLabel would show overlapping text if it were being used inside a nib as a subclass of UILabel with some preset text defined in the nib file.
- If a nil ```detectionBlock``` is passed, the label now disables its user interaction. This removes an unknown-selector exception crash and also covers the possibility of the tweet label being used just for cosmetic purposes, in the case that the developer might want the entire cell to be tapped regardless of its content (and thus not have the tweet label intercept touches).

## Implications
- If a URL does not have a protocol, it will be thought to be a ```http``` link. Therefore, protocol-less links will only be detected if ```http``` is a member of the ```validProtocols``` array.
- The ```test_setTextAndGetHotWords_setTextWithOneLinkWithSpecialCharacters_hotWords``` test (STTweetLabel_Tests.m, line 312) had to be changed as the specified URL is not valid in its entirety. (URLs cannot end with a punctuation character, which includes ```]``` and ```[```) Therefore, the valid range had to be changed in the test case.
- A test case has been added for a link with no protocol. (STTweetLabel_Tests.m, line 332)

---

These are just a few changes that I found to be quite useful in a project I've been assigned; any suggestions or feedback would be greatly appreciated and I hope these little additions will at least provide some food for thought. Thanks once again for your patience and for making such a useful addition to iOS's UI library. :) Merci de votre patience!