Re: Regular Expressions?
Re: Regular Expressions?
- Subject: Re: Regular Expressions?
- From: "Vincent E." <email@hidden>
- Date: Fri, 6 Jun 2008 15:39:36 +0200
Right, but that's a very trivial string replacement with no advanced
modifications.
I had thing like this perl script for changing case to "word caps" in
mind:
echo 'some test text' | perl -pe 's/\b(.*?)/\u\L$1/g'
search pattern would be "\b(.*?)"
replacement pattern would be "\u\L$1"
I would need something with capabilities like these.
On Jun 6, 2008, at 2:09 PM, dream cat7 wrote:
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, ...;
_______________________________________________
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