FROM : Oliver Cameron
DATE : Fri Nov 26 19:44:57 2004
Hi guys,
Not sure if my other mail got through to the list, so I'll try again.
I've been told I can use regex.h for powering the regular expression
searches in my app. I'm never actually touched pure C code (is regex.h
C?), so I've really got no idea how to implement it in a Cocoa based
application.
I did a 'man regex' in the Terminal and gave it a read. Seems I have to
do:
#include <regex.h>
I also realised there are 4 functions, but I only need to use 2. I seem
to need to provide regcomp with a regular expression string, it will
then transform that into a internally structured correct one. I then
need to pass that and the string I want to parse into regexec.
I understand all the theory work, but I'm still at a lost as to how to
use these functions, for example, in Obj-C, I would do something like:
NSString *hello = [regex parseString:@"hello"
withExpression:expression];
Any sort of C method example could help a lot.
I guess I could use NSTask, but I think that could cause major
slowdowns. I also know about the OmniFrameworks and others (MOKit
etc.), but I'd rather cook up my own engine if possible. Any help is
appreciated.
Thanks,
Oliver
DATE : Fri Nov 26 19:44:57 2004
Hi guys,
Not sure if my other mail got through to the list, so I'll try again.
I've been told I can use regex.h for powering the regular expression
searches in my app. I'm never actually touched pure C code (is regex.h
C?), so I've really got no idea how to implement it in a Cocoa based
application.
I did a 'man regex' in the Terminal and gave it a read. Seems I have to
do:
#include <regex.h>
I also realised there are 4 functions, but I only need to use 2. I seem
to need to provide regcomp with a regular expression string, it will
then transform that into a internally structured correct one. I then
need to pass that and the string I want to parse into regexec.
I understand all the theory work, but I'm still at a lost as to how to
use these functions, for example, in Obj-C, I would do something like:
NSString *hello = [regex parseString:@"hello"
withExpression:expression];
Any sort of C method example could help a lot.
I guess I could use NSTask, but I think that could cause major
slowdowns. I also know about the OmniFrameworks and others (MOKit
etc.), but I'd rather cook up my own engine if possible. Any help is
appreciated.
Thanks,
Oliver
| Related mails | Author | Date |
|---|---|---|
| Oliver Cameron | Nov 26, 12:19 | |
| Oliver Cameron | Nov 26, 19:44 | |
| Glenn Andreas | Nov 26, 23:00 | |
| Andrew Farmer | Nov 26, 23:07 | |
| Guy English | Nov 26, 23:52 | |
| mmalcolm crawford | Nov 26, 23:58 | |
| Matthew | Dec 10, 23:11 | |
| Chris Eplett | Dec 14, 13:47 |






Cocoa mail archive

