• 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: Regular Expression in Xcode Editor: newlines+whitespace
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Regular Expression in Xcode Editor: newlines+whitespace
      • From: Tomasz Kukielka <email@hidden>
References: 
 >Re: Regular Expression in Xcode Editor: newlines+whitespace (From: Chris Espinosa <email@hidden>)

  • Prev by Date: Re: xCode shortCuts on spanish keyboard...
  • Next by Date: Re: Show/hide whitespace characters (a.k.a. "invisibles") in Xcode editor?
  • Previous by thread: Re: Regular Expression in Xcode Editor: newlines+whitespace
  • Next by thread: Re: Regular Expression in Xcode Editor: newlines+whitespace
  • Index(es):
    • Date
    • Thread