• 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: Regular Expressions?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regular Expressions?


  • Subject: Re: Regular Expressions?
  • From: Bob Warwick <email@hidden>
  • Date: Fri, 6 Jun 2008 04:55:55 -0300

On 6-Jun-08, at 4:31 AM, Cemil Browne wrote:

Hi all,

This might be a really silly question - but am I missing something obvious?
Is there any support at all for regular expressions in the Cocoa libraries?


I can't find anything and I've found some third-party frameworks - but
surely something so necessary must be buried in the string classes
somewhere? How would I do a simple substring search or replace in 10.4?


Thanks,
Cemil


Hello -

There is no regular expression support in Cocoa. You might find http://www.cocoadev.com/index.pl?RegularExpressions useful in helping to find a library to do it for you.

	Search and replace in Cocoa looks like this:

NSString *someString = @"The quick brown fox";
NSString *newString = [someString stringByReplacingOccurrencesOfString:@"quick" withString:@"slow"];


You can find this in the NSString documentation. It creates a new string with the substring replaced.

-Bob Warwick
email@hidden
_______________________________________________

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


  • Follow-Ups:
    • Re: Regular Expressions?
      • From: David Troy <email@hidden>
  • Prev by Date: Re: List Guidelines and Resources
  • Next by Date: Re: Regular Expressions?
  • Previous by thread: Re: Regular Expressions?
  • Next by thread: Re: Regular Expressions?
  • Index(es):
    • Date
    • Thread