• 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
[ANN] RegexKitLite 2.0
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ANN] RegexKitLite 2.0


  • Subject: [ANN] RegexKitLite 2.0
  • From: John Engelhart <email@hidden>
  • Date: Mon, 7 Jul 2008 18:13:23 -0400

I've just pushed out RegexKitLite 2.0.

Documentation: http://regexkit.sourceforge.net/RegexKitLite/index.html
Download: http://downloads.sourceforge.net/regexkit/RegexKitLite-2.0.tar.bz2 (~40K)
Xcode 3.0 integrated docs: feed://regexkit.sourceforge.net/RegexKitLiteDocSets.atom


RegexKitLite is a lightweight NSString category extension that uses the ICU shared library that ships with Mac OS X as its regular expression pattern matching engine.

The major new features of RegexKitLite 2.0 are:

o The ability to split a string in to a NSArray with a regular expression.

o Search and replace using common $n capture substitution in the replacement string.

The following NSString methods were added:

- (NSArray *)componentsSeparatedByRegex:(NSString *)regex;
- (NSString *)stringByReplacingOccurrencesOfRegex:(NSString *)regex withString:(NSString *)replacement;


and the following NSMutableString method:

- (NSUInteger)replaceOccurrencesOfRegex:(NSString *)regex withString: (NSString *)replacement;

Search and replace supports $n capture substitution, such as:

replacedString = [@"Search and replace all these words." stringByReplacingOccurrencesOfRegex:@"\\b(\\w+)\\b" withString:@"<< $1>>"];

results in a replacedString of: @"<<Replace>> <<all>> <<these>> <<words>>."

Since regular expressions are often at the heart of a loop that is processing a large volume of data, I've made an effort to make things as fast as reasonably possible. RegexKitLite tries to cache data that is expensive to create, such as compiling a regular expression or performing a conversion of a string from its native encoding in to UTF-16, which is the only encoding ICU knows how to deal with. Little things like calling CFStringLength() or assigning a value indirectly through a __strong GC pointer add up pretty quickly when they're executed three million times in the course of processing a file.
_______________________________________________


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


  • Prev by Date: Re: controlling system muting ?
  • Next by Date: [Moderator] Re: iPhone SDK and sms.db file
  • Previous by thread: Re: problem with IKImageView and filters
  • Next by thread: MIDI Sequencing
  • Index(es):
    • Date
    • Thread