Thanks everyone for all your help on this.

The ?>X looks like a really handy feature.  But it
doesn't look like it works in the current version of
ORO.  According to its docs they only guarantee
support of Perl5.003 in version 2.0.  They are working
toward implementing features after Perl5.003 up to and
including 5.6.

So, what I've decided to do is use two Response
Assertions.  The first will check to make sure my
response contains (?s)((.*sample){8}) and the second
will check to make sure the response does not contain
(?s)((.*sample){9}).

Finding out about that (?s) modifier really helps us
in our ability to use jMeter.

Thanks again everyone for your help.  We were about to
give up on jMeter thinking we couldn't use it for what
we wanted.  But, right now, it looks like it will do
the job nicely and we'll be using it quite a bit.

Dan Yuen

--- Jordi Salvat i Alabart <[EMAIL PROTECTED]> wrote:
> At least on Perl v5.8.1, this will do the magic:
> 
> ^(?>.*?foo){8}(?!.*?foo)
> 
> Explanation:
> 
> ^ anchors the match at the beginning of the string
> 
> (?>X) is a "do not backtrack" or "intependent
> subexpression". Whatever 
> is matched by pattern X at first shot will be
> "bound" to this 
> subexpression, and won't be "given back" to be
> matched by a later .*
> 
> X*? is a non-greedy X* : it will match as little as
> possible, instead of 
> as much as possible as X* does.
> 
> X{8} is exactly equivalent to X{8,8}.
> 
> (?!X) is a negative lookahead: will match only if
> what follows does not 
> match X.
> 
> I really don't know whether ORO will support "?>",
> which is described in 
>   man perlre as a "highly experimental feature".
> 
> To complete the picture, use:
> 
> (?s)^(?>.*?foo){8}(?!.*foo)
> 
> Which will match responses containing 8 (but not 9)
> "foo"s independently 
> of whether they occur in the same or separate lines.
> 
> Good luck.
> 
> -- 
> Salut,
> 
> Jordi.
> 
> BAZLEY, Sebastian wrote:
> > True, but won't it stop looking when it has found
> 8 matches?
> > i.e. there could be more "sample"s later in the
> buffer?
> > 
> > ==
> > 
> > One could try anchoring the last sample:
> > 
> > (sample.*){7,7}(sample.*$){1,1}
> > 
> > but I think that would suffer from the same
> problem as the negative
> > look-ahead.
> > It may be tricky stopping the matcher from working
> its way past the leading
> > samples.
> > 
> > S.
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> > Sent: 01 October 2003 13:31
> > To: JMeter Users List
> > Subject: RE: Using Response Assertion to evaluate
> HTML details
> > 
> > 
> > Also,
> > 
> > (sample.*){8,8} will match exactly 8 occurrences. 
> > 
> > -Mike
> > 
> > On 1 Oct 2003 at 10:41, BAZLEY, Sebastian wrote:
> > 
> > 
> >>JMeter uses Jakarta ORO
> (http://jakarta.apache.org/oro/index.html) to
> >>implement Perl5 patterns.
> >>
> >>Since Perl includes multi-line patterns using the
> "m" and "s" 
> > 
> > modifiers:
> > 
> >><quote from Perlre document>
> >>m
> >>
> >>Treat string as multiple lines. That is, change
> ``^'' and ``$'' from
> >>matching the start or end of the string to
> matching the start or end 
> > 
> > of any
> > 
> >>line anywhere within the string. 
> >>
> >>s
> >>
> >>Treat string as single line. That is, change ``.''
> to match any 
> > 
> > character
> > 
> >>whatsoever, even a newline, which normally it
> would not match. 
> >></quote>
> >>
> >>It looks as though "s" might be best in your case.
> >>
> >>As a start, you could try matching sample 8 times
> using 
> > 
> > something like:
> > 
> >>(sample.*){8}
> >>This would eliminate fewer than 8 occurrences.
> >>
> >>(sample.*){9} should catch ones with 9 or more.
> >>
> >>So you could use two assertions; the first to
> match 8 samples, the 
> > 
> > second to
> > 
> >>NOT match 9.
> >>
> >>The tricky bit would be combining the two, as 
> > 
> > (sample.*){8}(?!.*sample)
> > 
> >>would presumably be happy to match 9 occurrences
> by starting 
> > 
> > the match with
> > 
> >>the second sample.
> >>
> >>I'm afraid I'll have to leave solving that as an
> exercise for the 
> > 
> > reader, as
> > 
> >>I don't know how myself.
> >>
> >>I could not find anything on the ORO pages about
> exactly what 
> > 
> > REs it
> > 
> >>supports, or if there are any exclusions.
> >>
> >>Perl itself has pretty good documentation on
> regular expressions. 
> > 
> > If you
> > 
> >>have a Perl installation, try perldoc perlre,
> perlrequick or 
> > 
> > perlretut.
> > 
> >>There is online documentation on the Activestate
> web-site and 
> > 
> > elsewehere. 
> > 
> >>Hope this will help you get started. If you find a
> good solution, 
> > 
> > please
> > 
> >>share it with us!
> >>
> >>S.*n
> >>-----Original Message-----
> >>From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> >>Sent: 01 October 2003 00:10
> >>To: JMeter Users List
> >>Subject: Re: Using Response Assertion to evaluate
> HTML details
> >>
> >>
> >>Currently, the Response Assertion only supports a
> yes/no 
> > 
> > response 
> > 
> >>to whether the text includes the regex. 
> Supporting match counts 
> >>would be useful too, I think.
> >>
> >>-Mike
> >>
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to