Re: OFRegularExpression escape character syntax?
Re: OFRegularExpression escape character syntax?
- Subject: Re: OFRegularExpression escape character syntax?
- From: Sherm Pendley <email@hidden>
- Date: Mon, 11 Nov 2002 22:36:45 -0500
On Monday, November 11, 2002, at 10:17 PM, Michael Norris wrote:
Anyone here used the OFRegularExpression class from the OmniFoundation
code? It's working beautifully for most things, but I'm having trouble
escaping the period character: doing a matchInString with @"\.+" just
returns the entire string, rather than a series (of arbitrary length >
0) of periods.
It looks to me like GCC is interpreting "\." as an escape when compiling
your code. Since "." has no special meaning as an escape character, it's
used as-is. So, the above string is compiled as ".+" - which would
behave as you describe, returning the entire string.
What you need to do is "escape the escape" in GCC, so that it compiles a
backslash into your string instead of trying to interpret it as an
escape sequence. To do that, use two backslashes, like this: @"\\.+"
sherm--
If you listen to a UNIX shell, can you hear the C?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.