Re: OFRegularExpression escape character syntax?
Re: OFRegularExpression escape character syntax?
- Subject: Re: OFRegularExpression escape character syntax?
- From: Michael Norris <email@hidden>
- Date: Tue, 12 Nov 2002 17:54:55 +1300
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.
Yup - you were spot on. Now instead of @"...", or even @"\.\.\.", I
have to use @"\\.\\.\\." which is ugly as hell, but works perfectly...
Sheesh, I wonder if programmers have shortened life expectancy...
_______________________________________________
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.