For quite sometime, I've been battling OomniFoundation and MOKit, trying in vain to get their regular expression tools to work properally. All I'm trying to do is take an NSString and parse out all the words and their NSRange within the NSString.
OFRegularExpression and OFRegularExpressionMatch work for about the first five words or so, but then starts complaining about rewind marks.
Here's essentially what I was doing:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
OFRegularExpression *exp=[[OFRegularExpression alloc] initWithString:<font color = orange>@"([<font color = blue>0</font>-9A-Za-z]+)"</font>];
OFRegularExpressionMatch *match = [exp matchInString:string];
while(<font color = blue>1</font>)
{
NSString* temp;
if(match==nil || (temp=[match subexpressionAtIndex:<font color = blue>0</font>])==nil) break;
else
{
NSLog(temp);
match = [exp findNextMatch];
}
}
</font>[/code]
(I Apologize for any syntax errors; I just recreated everything after blowing away my old code to try something else). This doesn't work for very long. I can't even figure out the MOKit implementation... so can anyone help a poor guy out?
Thanks,
F-bacher