[TxMt] Re: Matching multiple lines in a grammar pattern

Chris Rebert cvrebert at gmail.com
Sat Aug 9 03:38:14 UTC 2008

>From what I can grok of the ANTLR Book, I don't think either ^ as
start-of-line or {n,m} for specifying number of repetitions are

Have you tried:

EXTRA_NEWLINES : '\n' '\n'+;

- Chris

On Fri, Aug 8, 2008 at 5:53 PM, Nate Cavanaugh <nate at shift22.com> wrote:
> Hi all,
> I'm trying to add an invalid scope to a certain group of lines. Basically,
> the regex pattern I would like to match is this:
> ^(\n){2,}
> Which works fine in the Find dialog, but when trying to use it as a pattern,
> it doesn't work. I am guessing because of the way that the pattern matching
> works for grammars, but is there a way to match this?
> The logic is, I would like to match every line that has no content on it,
> but is part of a group of 2 or more extraneous lines.
> One \n is valid, but 2 or more is invalid.
> I've tried so many variations of trying to use captures, matching content,
> but it seems to be treating each line as it's own match independent of the
> previous or next ones.
> Anyone know how I might go about applying this?
> Any help is greatly appreciated.
> Thanks!
> --
> View this message in context: http://www.nabble.com/Matching-multiple-lines-in-a-grammar-pattern-tp18901103p18901103.html
> Sent from the textmate users mailing list archive at Nabble.com.
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate

More information about the textmate mailing list