Re: MOKit
Re: MOKit
- Subject: Re: MOKit
- From: Nico <email@hidden>
- Date: Sun, 11 Aug 2002 15:32:44 +0200
Hi Brock :>
Thanks you for all these information, now I realise this framework is really
powerful :>
Do you know if I can freely use this framework inside my app ?
Thanks. Nico
On 11/08/02 1:06, "Brock Brandenberg" <email@hidden> wrote:
>
Hi Nico.
>
>
MOKit is pretty easy to use. Mike did a nice job implementing it and
>
provided a nice function to do the subexpression substitution.
>
>
To create a regular expression object:
>
>
MORegularExpression *regex = [[MORegularExpression alloc]
>
initWithExpressionString:@"(.*)my(.*)" ignoreCase:YES];
>
>
To use it to find matches in a string:
>
>
NSMutableString *testString = [NSMutableString stringWithString:@"This is my
>
string."];
>
BOOL matches = [regex matchesString:testString];
>
if( matches )
>
{
>
[testString setString:substituteSubexpressions( regex, @"\\1your\\2",
>
testString )];
>
}
>
>
A couple points to remember: Note the double escaped characters in the
>
substituteSubexpressions() parameter. You'll need to do this in string
>
literals, but not if you're pulling the strings from text fields in a UI.
>
Also, you cannot re-use a regex. If you need to change the expression
>
string, you'll need to release the regex and create a new one.
>
>
This should get you pointed in the right direction. If you're unfamiliar
>
with regular expressions, you'll have a bit of reading to do before going
>
much further though.
>
>
Good luck,
>
Brock Brandenberg
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
- Follow-Ups:
- Re: MOKit
- From: Brock Brandenberg <email@hidden>
References: | |
| >Re: MOKit (From: Brock Brandenberg <email@hidden>) |