• 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: NSPredicate and Regexes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPredicate and Regexes


  • Subject: Re: NSPredicate and Regexes
  • From: Keary Suska <email@hidden>
  • Date: Sun, 30 Mar 2008 09:48:44 -0600
  • Thread-topic: NSPredicate and Regexes

on 3/30/08 4:26 AM, email@hidden purportedly said:

> NSString* regexFormat=@"[+-]?([0-9]*\.?[0-9]+)?[A-Z|a-z][A-Z|a-z|
> 0-9]*([+-]?([0-9]*\.?[0-9]+)?[A-Z|a-z][A-Z|a-z|0-9]*)*";
> NSString* equation =@"X1+2X2+3X3";

The compiler should have warned you about this: backslashes indicate escape
sequences, so all your '\.' become plain old '.' when the string is parsed.
You should instead use '\\.'. The NSPredicate examples show this.

I suspect that Python has quoting semantics like Perl, so the backslashes
aren't seen as escape sequences, as they would if the string was
double-quoted.

Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

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

References: 
 >NSPredicate and Regexes (From: Romain Pechayre <email@hidden>)

  • Prev by Date: How to set color file labels?
  • Next by Date: Re: How to set color file labels?
  • Previous by thread: NSPredicate and Regexes
  • Next by thread: CGDisplayReconfigurationCallBack
  • Index(es):
    • Date
    • Thread