I have a string for example @"You've earned Commentator and 4 ##other$$ badges". I want to retreive the substring @"other", which is delimited by ## and $$. I made a NSRegularExpression like this:
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"##(.*)$$" options:NSRegularExpressionCaseInsensitive error:nil];
This completely ignores $$ and returns stuff starting with ##. What am I doing wrong? thanks.
Thats because ‘$’ is a special character that represents the end of the line. Try
\$\$to escape it and tell the parser you want the characters.