 |
 |
Regular Expressions in Obj-C...can't get anything to work
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Aug 2007
Status:
Offline
|
|
I'm making an iPhone app, and I need to do a search-and-replace regex on a string. I've tried OmniFoundation, RegexKit, ObjPCRE, and many other third-party regex libraries, and none of them work for me. Omni results in dozens of errors when I compile, RegexKit results in one error ("cannot find Cocoa/Cocoa.h"), and ObjPCRE results in the following three errors:
"_pcre_free", referenced from:
_pcre_free$non_lazy_ptr in objpcre.o
"_pcre_compile", referenced from:
-[ObjPCRE compileWithPattern:andOptions:] in objpcre.o
"_pcre_exec", referenced from:
-[ObjPCRE regexMatches:options:startOffset:error:] in objpcre.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
If you know how to get any of these regex libraries working on the iPhone, I would be grateful for the help.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status:
Offline
|
|
I'd go with a straight C library, like PCRE.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Aug 2007
Status:
Offline
|
|
That would involve quite a bit of work, including converting all my NSStrings to CStrings and then back again, and with my luck there's no guarantee it would work any better. I'd like to keep it purely Objective-C if possible, for the sake of simplicity in my code.
|
|
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Dec 2000
Status:
Online
|
|
Originally Posted by OliverTwist
That would involve quite a bit of work, including converting all my NSStrings to CStrings and then back again
I'll save you from all that extremely arduous work by providing some lines for you to copy and paste into your project:
const char *myCString = [myNSString UTF8String];
NSString *myNewNSString = [NSString stringWithUTF8String:myCString];
Whew, I think I just threw my back out typing that. I'd better go lie down for a while.
, and with my luck there's no guarantee it would work any better.
Yes there is, because the reason you're getting those link errors is because it's looking for those symbols which are in the C library, and not finding them. A little bird tells me that if you actually had the C library, that would work.
(please forgive my snark: this post was written 100% tongue-in-cheek  )
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|