Re: Regular Expression in Xcode Editor: newlines+whitespace
Re: Regular Expression in Xcode Editor: newlines+whitespace
- Subject: Re: Regular Expression in Xcode Editor: newlines+whitespace
- From: Tom Worster <email@hidden>
- Date: Mon, 03 Nov 2008 09:06:58 -0500
- Thread-topic: Regular Expression in Xcode Editor: newlines+whitespace
On 11/2/08 11:38 PM, "Chris Espinosa" <email@hidden> wrote:
> Xcode doesn't do cross-line regex matches. (Neither does grep, for
> that matter.)
>
> If you are looking for a pattern at the beginning of the line, use the
> regex "beginning of line" marker, "^". And of course you want to find
> runs of whitespace, not just the first instance, so the regex you
> want is
>
> ^\s+
chris is right. ^ is the way to anchor a pattern at the start of a line.
but ICU regex (which Xcode claims it uses for the regular expression find in
the text editor) does match across lines. so, i'm curious....
icu regex, like perl, supports multiline mode as an option. it also uses
perl's syntax for turning options (i.e. modifiers) on or off within the
regex.
see the Flag Options section of
http://www.icu-project.org/userguide/regexp.html
http://www.perl.com/doc/manual/html/pod/perlre.html has a better explanation
of what they mean. in multiline mode, ^ and $ match the beginning and end of
lines within the string, otherwise they match the beginning and end of the
string (which i would think, in Xcode, would be the file). in multiline
mode, . matches any character except newline, otherwise it matches any
character.
nevertheless, but i can't get Xcode to do any cross-line matching with
multiline mode turned off. i wonder if Xcode broke ICU regex in this aspect.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden