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

AGRegex question


  • Subject: AGRegex question
  • From: Koen van der Drift <email@hidden>
  • Date: Thu, 9 Feb 2006 21:20:41 -0500

Hi,

I am using the AGRegex framework to implement a bunch of perl regular expressions in my code to parse a specific text file. AGRegex uses pcre, so if I understand correctly, a perl regex should be able to be used.

I started with a relatively simple regex to determine whether a string only contains whitespace and the word 'foo' on a line. Here's what I have now:

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

When I built the code, I got a warning: unknown escape sequence '\s'. I solved that by escaping \s as follows:

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


The warning indeed went away. But when I debug the code, regexMatch always returns NO, even when the code encounters a line that only contains foo.



Any idea what I might be doing wrong?

thanks,

- 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


  • Follow-Ups:
    • Re: AGRegex question
      • From: Koen van der Drift <email@hidden>
  • Prev by Date: adding rows to an array-controller managed table atomically
  • Next by Date: Native 2.2 target problem
  • Previous by thread: Re: adding rows to an array-controller managed table atomically
  • Next by thread: Re: AGRegex question
  • Index(es):
    • Date
    • Thread