• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa-dev Digest, Vol 1, Issue 330
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa-dev Digest, Vol 1, Issue 330


  • Subject: Re: Cocoa-dev Digest, Vol 1, Issue 330
  • From: Joe Chan <email@hidden>
  • Date: Fri, 26 Nov 2004 16:16:28 -0500

Um, if I understand your question correctly, you're asking how to use C functions? You do something like this:

regex_t	myRegex;
int err = regcomp(&myRegex, myExpr, REG_EXTENDED);


On Nov 26, 2004, at 3:29 PM, email@hidden wrote:

Date: Fri, 26 Nov 2004 18:44:57 +0000
From: Oliver Cameron <email@hidden>
Subject: Using regex.h
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed

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



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: setAutoresizingMask help
  • Next by Date: Using Keychain for storing archived object ?
  • Previous by thread: Question about NSImage and setFlipped
  • Next by thread: Using Keychain for storing archived object ?
  • Index(es):
    • Date
    • Thread