Thanks for the responses everyone!

   I do not think I can answer this, and there may not be a way to do
what you want, but I want to clarify the question.  Is your intention to
match the "STALIST 6" with the start pattern and, since it ends in " 6",
match the next 6 lines with the end pattern?

   BTW, do you realize that in your end pattern, ".\+" will match all of
      "STA1" "n" "" "" "" "" "" ""
and .* will then match nothing?

The values within the quotes can be any text [\w\d-\.\+].  The 6 value
on the first line tells me how many lines are following. I needed to
use .* in the case where the value is set to zero, otherwise my
example where the number is set to zero doesn't match.

On Thu, May 11, 2006 at 10:12:32AM -0400, Benji Fisher wrote:
On Wed, May 10, 2006 at 02:53:20PM -0600, Shaun Cummins wrote:
> I would like to use a variable within a regular expression counter. I
> tried the following, but it gave me a syntax error:
>
> :syntax region Keyword start="^\w\+\s\+\z(\d\+\)"
> end=#\(\s*\(".\+"\|'.\+'\).*\n\)\{\z1\}#
[snip]
     I do not think I can answer this, and there may not be a way to do
what you want, but I want to clarify the question.  Is your intention to
match the "STALIST 6" with the start pattern and, since it ends in " 6",
match the next 6 lines with the end pattern?

If that's the case I suspect the only way to do it is to set up
a separate syntax entry for each possible number, so it would be

 syntax region Keyword start="^\w\+\s\+1\>" end={pattern for one line}
 syntax region Keyword start="^\w\+\s\+2\>" end={pattern for two lines}

and so on.  Perhaps "syntax match" would be better, depending on the
precise requirements.  It's bad news if the number can go as high as
2000 but I can't think of an easier way to do it.

Thanks Matthew. I thought that might be the only way to do it.
Theoretically the number is unlimited, but in practice the number is
almost always less than 12. Since I can't use the captured value in
the counter, I think you are right. This probably is the only way to
do it.

-Shaun

Reply via email to