I am trying to detect the following expression: $
for example
$john
or
$mike
What is wrong with my regex?
//Check for $symbol
NSRegularExpression *symbolRegex = [[NSRegularExpression alloc] initWithPattern:@"($[a-zA-Z0-9_]+)"
options:NSRegularExpressionCaseInsensitive
error:nil];
matches = [symbolRegex matchesInString:labelText options:0 range:NSMakeRange(0, [labelText length])];
for (NSTextCheckingResult *result in matches) {
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"symbol://%@",[labelText substringWithRange:result.range]]];
[bodyLabel addCustomLink:url inRange:[result range]];
}
[symbolRegex release];