Heh, I’d actually argue that NSScanner is a much much better API to use here 
(and in fact nearly everywhere).  Regular expressions constrain you only to 
regular grammars, which are a pretty small set.  In my experience 99% of the 
use of them is actually trying to parse something that’s not *quite* a regular 
grammar, and uses a hack on top of regular expressions to do something 
not-quite-right.

NSScanner by comparison makes the separation of what’s scanning/tokenisation, 
and what’s up to your (turing complete) program much more clear.  So basically, 
(at least in my opinion), if you want to parse something that’s regular, 
NSScanner is a great choice.  If you want to parse something that’s context 
free, look at CoreParse (Not tooting my own horn, honest).  And finally, if you 
want to parse something that’s more even than that, then you’re probably back 
to NSScanner and a turing complete program.

About the only use for regular expressions I can think of is asking NSScanner 
to scan something that it doesn’t by default know about.

Tom Davie

On 10 Aug 2013, at 19:53, Jerry Krinock <je...@ieee.org> wrote:

> 
> On 2013 Aug 10, at 10:07, Boyd Collier <bcolli...@cox.net> wrote:
> 
>> but if someone has already come up with a clean way of scanning in reverse
> 
> In Mac OS X 10.7+, we have NSRegularExpression.  In earlier systems, call out 
> to Perl.  Regexes are fun.
> 
> 
> _______________________________________________
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/tom.davie%40gmail.com
> 
> This email sent to tom.da...@gmail.com

_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to