• 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: AGRegex question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AGRegex question


  • Subject: Re: AGRegex question
  • From: Nathan Day <email@hidden>
  • Date: Sun, 12 Feb 2006 12:10:05 +1100

I would pick the second one simply because it does not require a third party library. Which is quicker, I don't know is this a situation where it really matters.

On 11/02/2006, at 11:07 PM, Koen van der Drift wrote:


On Feb 10, 2006, at 3:01 AM, Nathan Day wrote:

Yes, the /'s in pearl are the equivalent of double quote but to define a regular expression instead of a string, the / is not part of the regular expression itself.


Great, thanks. Looking at the code, though, I was wondering which is faster/better/easier:


regex = [AGRegex regexWithPattern: @"^\\s*foo\\s*$"];
regexMatch = [regex findInString: currentLine];

if (regexMatch)
{
	...
}

or:

if ([[currentLine stringByTrimmingCharactersInSet:
			[NSCharacterSet whitespaceCharacterSet]] isEqualToString: @"foo"])
{
	...
}



- Koen.

_______________________________________________ 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
References: 
 >AGRegex question (From: Koen van der Drift <email@hidden>)
 >Re: AGRegex question (From: Koen van der Drift <email@hidden>)
 >Re: AGRegex question (From: Nathan Day <email@hidden>)
 >Re: AGRegex question (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Is it a Universal Binary?
  • Next by Date: Re: Problem moving subview within superview
  • Previous by thread: Re: AGRegex question
  • Next by thread: Native 2.2 target problem
  • Index(es):
    • Date
    • Thread