I have NSString
that contain this string :
c&&(b.signature=Rk(c));return ql(a,b)}
The RK
can be any two chars.
I try to get the RK
from the string with (RegexKitLit):
NSString *functionCode = [dataStr2 stringByMatching:@".signature=(.*?)\(" capture:1L];
and functionCode
is always nil
.Any idea what wrong?
Don't bother with regular expressions for this. If the format of the string is always the same then you can simply do:
NSString *dataStr2 = @"c&&(b.signature=Rk(c));return ql(a,b)}";
NSString *functionCode = [dataStr2 substringWithRange:NSMakeRange(16, 2)];
If the string is not quite so fixed then base it on the position of the =
.
NSString *dataStr2 = @"c&&(b.signature=Rk(c));return ql(a,b)}";
NSRange equalRange = [dataStr2 rangeOfString:@"="];
NSString *functionCode = [dataStr2 substringWithRange:NSMakeRange(equalRange.location + equalRange.length, 2)];
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments