0
不工作我有這個字符串:爲什麼要標記'。'在NSRegularExpression
NSString* yourString = @"(;GM[1]FF[4]SZ[19]AP[CGoban Pro:2.2]PW[Michael Redmond]WR[9p]DT[2010-12-12]KM[6.5]RE[B+0.5]AN[Michael Redmond]BK[1]C[toto : [test]]";
,我有這樣的正則表達式:
NSRegularExpression* regex = [NSRegularExpression
regularExpressionWithPattern:@"((RU)|(KM)|(TM)|(OT)|(PW)|(PB)|(WR)|(BR)|(WR)|(DT)|(RE))\\[[\\w ]+\\]"
options:NSRegularExpressionCaseInsensitive
error:&error];
我不能有\ w和\數值。或只有。什麼都不返回 任何人都可以幫助我嗎?
謝謝
作爲一個結果,你期待什麼,你究竟得到了什麼?另外,如果你展示瞭如何使用正則表達式對象,這將會很有幫助。 – 2013-04-27 02:33:54
適合我。我得到匹配「PW [Michael Redmond]」和「WR [9p]」。你還試圖捕捉「KM [6.5]」還是「DT [2010-12-12]」? – 2013-04-27 04:05:45
是的。 我有\\ w的正常文字,但我沒有6.5或2010-12-12。 我怎樣才能得到他們所有的人? – 2013-04-27 22:13:56