【发布时间】:2009-12-08 21:43:04
【问题描述】:
我正在使用 RegexKitLite,我正在尝试匹配一个模式。
以下正则表达式模式无法捕获包含带有标题的 N 的单词:ñ。
我缺少字符串转换吗?
subjectString = @"define_añadir";
//regexString = @"^define_(.*)"; //this pattern does not match, so I assume to add the ñ
//regexString = @"^define_([.ñ]*)"; //tried this pattern first with a range
regexString = @"^define_((?:\\w|ñ)*)"; //tried second
NSString *captured= [subjectString stringByMatching:regexString capture:1L];
//I want captured == añadir
【问题讨论】:
标签: objective-c regex iphone cocoa-touch nsstring