You have many backslash characters, use:
regexp = [[NSRegularExpression alloc] initWithPattern:@".*?\\+.*?\\+.*?\\+.*?\\+.*?\\+.*?\\+" options:0 error:nil];
To get the string \
in the string, it must be escaped: \\
. Thus, \\\+
applies the first \
to the screening of the second \
, and the third \
tries to avoid the plus sign +
, which is an illegal escape.
source share