KILabel icon indicating copy to clipboard operation
KILabel copied to clipboard

regex to not detect hashtag after a character not space

Open techinpark2 opened this issue 10 years ago • 0 comments

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.

techinpark2 avatar Sep 03 '15 07:09 techinpark2