objective c - about RegexKitLite linebreak -
objective c - about RegexKitLite linebreak -
i'm utilize regexkitlite match texts:
xxx*[abc]*xxx
and want match [abc],and utilize regular:
nsstring *result = [@"xxx[abc]xxx" stringbymatching:@"\\[(.*)?\\]" capture:1];
then, result [abc].but, if have linebreak in there:
xxx[ab c]xxx
it's dosen't work. utilize ([\s\s]*), dosen't math [abc]. how can match text? give thanks you
the .
not match new lines default. utilize
... stringbymatching:@"(?s:\\[(.*)?\\])" ... // ^^^^ ^
or supply rkldotall alternative -stringbymatching:options:inrange:capture:error: method.
alternatively, utilize greedy variant
@"\\[([^\\]]*)\\]" // \[ ( [ ^\] ] ) \]
objective-c line-breaks regexkitlite
Comments
Post a Comment