adi*_*dit 0 iphone objective-c ipad ios
我目前有以下正则表达式:
static inline NSRegularExpression * AuthorRegularExpression() {
if (!__authorRegularExpression) {
__authorRegularExpression = [[NSRegularExpression alloc] initWithPattern:@"-\\s*(.)*$" options:NSRegularExpressionCaseInsensitive error:nil];
}
return __authorRegularExpression;
}
Run Code Online (Sandbox Code Playgroud)
正如您在模式中看到的那样,它会检测到一个短划线( - ),后跟一些字符串.但是现在我已经将短划线的格式更改为em-dash.所以字符串如下所示:
NSString *dashAuthor = [NSString stringWithFormat:@"%C %@", 0x2014, self.theme.quoteAuthor];
Run Code Online (Sandbox Code Playgroud)
我现在如何更改正则表达式以反映这一点,因此它可以找到一个带有尾随em-dash的作者.
归档时间: |
|
查看次数: |
710 次 |
最近记录: |