A simple to use drop in replacement for UILabel for iOS 7 and above that highlights links such as URLs, twitter style usernames and hashtags and makes them touchable.
MIT License
470
stars
133
forks
source link
regex to not detect hashtag after a character not space #39
I am trying to scan for hashtags from NSStrings in Objective-C and I am using regex.
I made a test status on Facebook / Instagram to see what are the valid hashtags as it is where
Now KILabel.m (getRangeForHashTags line : 437)
regex = [[NSRegularExpression alloc] initWithPattern:@"(?<!\w)#([\w_]+)?" options:0 error:&error];
My Solution (It's works fine. when not space)
I am trying to scan for hashtags from NSStrings in Objective-C and I am using regex. I made a test status on Facebook / Instagram to see what are the valid hashtags as it is where
Now KILabel.m (getRangeForHashTags line : 437)
regex = [[NSRegularExpression alloc] initWithPattern:@"(?<!\w)#([\w_]+)?" options:0 error:&error]; My Solution (It's works fine. when not space)
regex = [[NSRegularExpression alloc] initWithPattern:@"((#)([\w_]+)?)" options:0 error:&error]; Thanks.