The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > Developer > Omni Frameworks
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
OFRegularExpression Queston Thread Tools Search this Thread Display Modes
If I have the string "alphalpha" and create an OFRegularExpression with the regular expression "alpha", is there any way to match both "alpha"s in the aforementioned string? The OFRegularExpression seems to skip to the second "l" after matching the first "alpha"--is there any way to start at each letter rather than after each match? Thanks.
 
Hmm. This seems like a bug. Maybe we should change OFRegularExpressionMatch to fix it.

Meanwhile, the way that you could do it in your code is to use OFRegularExpression's -matchInString:range: method to loop through matches like so:

OFRegularExpression *expression; // the expression
NSString *string; // string searching through
NSRange searchRange = NSMakeRange(0, [string length]);
OFRegularExpressionMatch *match;

while ((match = [expression matchInString:string range:searchRange])) {
// do whatever you want with the match, then
searchRange.location = [match matchRange].location + 1;
searchRange.length = [string length] - searchRange.location;
}

Hope this helps!
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
OFRegularExpression help sunfire Omni Frameworks 0 2009-06-04 08:12 AM


All times are GMT -8. The time now is 01:35 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.