Re: Regular Expressions?
Re: Regular Expressions?
- Subject: Re: Regular Expressions?
- From: dream cat7 <email@hidden>
- Date: Fri, 6 Jun 2008 13:09:45 +0100
No that would require finding rangeOfRegex followed by a call to
replaceCharactersInRange
NSRange range = [theString rangeOfRegex:@"regex" capture:0];
if( ! NSEqualRanges(range, ((NSRange){NSNotFound, 0} )) )
[theString replaceCharactersInRange:range withString:@"newstring"];
compare that to the RegexKit equivalent which is
- (NSString *)stringByMatching:(id)aRegex replace:(const
RKUInteger)count withReferenceFormat:(NSString *
const)referenceFormatString, ...;
On 6 Jun 2008, at 11:01, Vincent E. wrote:
But RegexKitLite does not support substitution, does it?
Regex pattern matching is one thing, regex string substitution
another.
On Jun 6, 2008, at 11:34 AM, dream cat7 wrote:
Perhaps also consider RegexKitLite, which is written by the same
author. The difference is it links to shared libicu thats already
distributed in the os. No need to embed some specific version of
PCRE library into your app included with the regexkit (saves ~1.6mb
in the bundle). Also the icu library is something apple uses (and
unlikely to go away in future releases of OS X).
On 6 Jun 2008, at 09:22, Cemil Browne wrote:
Thanks to everyone who replied - I appreciate the help.
The best solution I've found (and been told) is to use a third
party Regex
library - http://regexkit.sourceforge.net/ appears to be decent.
NSScanner does not really appear to do what I'm looking for - but
is useful
to know about regardless.
Thanks all,
-Cemil
On Fri, Jun 6, 2008 at 6:11 PM, Citizen <email@hidden>
wrote:
If you are not married to using regular expressions, NSScanner
can do much
the same in a more verbose (generally easier to read) way. I only
mention
this because it is often overlooked.
On 6 Jun 2008, at 08:31, Cemil Browne wrote:
Hi all,
This might be a really silly question - but am I missing something
obvious?
Is there any support at all for regular expressions in the Cocoa
libraries?
I can't find anything and I've found some third-party frameworks
- but
surely something so necessary must be buried in the string classes
somewhere? How would I do a simple substring search or replace
in 10.4?
Thanks,
Cemil
_______________________________________________
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
_______________________________________________
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 <email@hidden
>
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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