Re: NSString and regular expressions
Re: NSString and regular expressions
- Subject: Re: NSString and regular expressions
- From: Alastair Houghton <email@hidden>
- Date: Fri, 31 Jul 2009 10:30:56 +0100
On 31 Jul 2009, at 01:04, BareFeet wrote:
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 wouldn't lose much sleep over it, to be honest, as long as you stick
to ICU's C API (as opposed to the C++ part).
As far as I understood, the original reason for not providing the
headers was that the C++ ABI was not stable and so a program linked
against ICU on one version of Mac OS X might not work on a subsequent
version (assuming it went and used the C++ API). I don't know why the
headers still aren't shipped with OS X...
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?
ICU's regexp engine is pretty complete, though it doesn't have:
1. Named capture groups; e.g. in Python you can do
(?P<myGroup>[a-zA-Z0-9]*)
and you can then retrieve the capture by name rather than by index.
This is a very useful feature as it lets you alter your regexp without
having to renumber everything.
You can also do backrefs to named capture groups (in Python) using e.g.
(?P=myGroup)
Again, this makes it easier to change your regexp without breaking
everything.
2. Conditional expressions, e.g.
(?(myGroup)then-part|else-part)
The above would match the text "then-part" *if* a group named
"myGroup" had already matched, otherwise it would match "else-part".
You can also use a number rather than a name to identify the match
group, and lookahead/lookbehind expressions are supported in there also.
I wrote and submitted a patch some time ago to add these features to
ICU. I don't know why but it doesn't seem to have made it back to the
main source tree. If anyone is interested in these extras, they're
here (though that patch was generated against ICU 3.6):
http://alastairs-place.net/2006/09/icu-regular-exp/
There are open tickets in the ICU bug tracker (#2907 and #5312) that
refer to these.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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