• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSString and regular expressions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString and regular expressions


  • Subject: Re: NSString and regular expressions
  • From: BareFeet <email@hidden>
  • Date: Fri, 31 Jul 2009 10:04:25 +1000

Hi John and all,

You might want to look at AGRegex which is very compact (one class) and which uses PCRE:

http://colloquy.info/project/browser/trunk/Frameworks/AGRegex


Of note, Colloquy appears to have switched to RegexKitLite itself:

http://svn.colloquy.info/project/changeset/4301

I did notice that log entry, but thought it was never acted upon (ie they are still using AGRegex).


RegexKitLite looks promising. It claims to only require you to add the .h and .m file to your project and link to the libicucore.dylib library.

The documentation notes: "Warning: Apple does not officially support linking to the libicucore.dylib library." In reality, how worried should I be about this? I am amazed that Cocoa doesn't provide regex itself. Surely Apple must provide or recommend something to do the job.

As quoted earlier:

Unfortunately, RegexKit Lite (the stripped-down version) uses the built-in ICU library which uses a syntax quite different to the PCRE that most people are used to.

At first glance through the "ICU Syntax" documentation included with RegexKitLite, it appears the same as what I'm used to. At least it supports \s for whitespace, \w for words, (?=...) for look ahead. I did, however, discover:


Single Quote
Two single quotes represent a single quote, either inside or outside single quotes. Text within single quotes is not interpreted in any way, except for two adjacent single quotes. It is taken as literal text— special characters become non-special. These quoting conventions for ICU character classes differ from those of Perl or Java. In those environments, single quotes have no special meaning, and are treated like any other literal character.

I guess I can deal with that.

Has anyone discovered any other issues (or had successes) dealing with ICU syntax in RegexKitLite and RegexKitLite in general?

Thanks,
Tom
BareFeet

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSString and regular expressions
      • From: John Engelhart <email@hidden>
    • Re: NSString and regular expressions
      • From: Alastair Houghton <email@hidden>
    • Re: NSString and regular expressions
      • From: Charles Srstka <email@hidden>
References: 
 >NSString and regular expressions (From: Rick Mann <email@hidden>)
 >Re: NSString and regular expressions (From: Dave DeLong <email@hidden>)
 >Re: NSString and regular expressions (From: Rob Keniger <email@hidden>)
 >Re: NSString and regular expressions (From: John Engelhart <email@hidden>)

  • Prev by Date: Re: Bindings for dictionaries inside of an array
  • Next by Date: Re: NSString and regular expressions
  • Previous by thread: Re: NSString and regular expressions
  • Next by thread: Re: NSString and regular expressions
  • Index(es):
    • Date
    • Thread