You ask an interesting computer science question (that's unrelated to Cocoa). Surely the following sequence of words would produce Word[1-9]{1,2} instead of Word[0-9]{1,2} because there is no representative 0 in the sample ? "Word1" "Word2" "Word5" "Word8" "Word11" "Word19" "Word23" "Word45" "Word77"
Anyway, I think this is an unsolvable problem, and I might start with an attempted proof of its unsolvability rather than a solution. Lots of artificial intelligence and/or statistical pattern recognition could be applied to achieve reasonable results in general cases. If you have specific cases like letters followed by numbers you might use a lexer and parser like flex/bison. Have you considered a "perfect hash" ? What are you really trying to achieve ? http://en.wikipedia.org/wiki/Perfect_hash_function http://www.nist.gov/dads/HTML/minimalPerfectHash.html _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]