You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Ed Young <ej...@SummitBid.com> on 2006/12/04 14:45:58 UTC

response assertion: 2 questions

Question 1.
I'm trying to figure out how to test for a numeric value of a
particular character length. An example is:
234335675
or
001454668

The easy part is the numeric check:
[0-9]
or
\d

I'm not sure how to check the length part and combine it with the
numeric part into the regexp.

I see that
{n}

says "match exactly n times". I'm using the demo applet at:
http://jakarta.apache.org/oro/demo.html
 to test my regexps but so far no luck.

Question 2:
If I add a "pattern to test" is it logically AND'd to the other
patterns I set up?

Thanks,

-- 
Ed

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: response assertion: 2 questions

Posted by sebb <se...@gmail.com>.
\d{10} *does* mean to match exactly 10 digits.

But you are right that it can match something *containing* more than
10 - it will match the 10 and stop looking further.

Sorry, I should have spotted that ...

To look for exactly 10 digits with nothing else, use the "matches" checkbox.
This only succeeds if the RE matches everything.

If you are looking for a 10 digit string which can be surrounded by
non-digits, you can try:

\D\d{10}\D

S.
On 05/12/06, Ed Young <ej...@summitbid.com> wrote:
> \d{10} not quite...
>
> \d{10} is true for any string of numeric *at least* 10 in length.
>
> The response I'm looging for is:
>
> 1. I'm looking for a single numeric string of *exactly* 10. No more, no less.
> 2. Nothing else in the response.
>
> It's simple, but I'm missing it...
>
>
> On 12/4/06, sebb <se...@gmail.com> wrote:
> > On 04/12/06, Ed Young <ej...@summitbid.com> wrote:
> > > Question 1.
> > > I'm trying to figure out how to test for a numeric value of a
> > > particular character length. An example is:
> > > 234335675
> > > or
> > > 001454668
> > >
> > > The easy part is the numeric check:
> > > [0-9]
> > > or
> > > \d
> > >
> > > I'm not sure how to check the length part and combine it with the
> > > numeric part into the regexp.
> > >
> > > I see that
> > > {n}
> > >
> > > says "match exactly n times". I'm using the demo applet at:
> > > http://jakarta.apache.org/oro/demo.html
> > >  to test my regexps but so far no luck.
> >
> > \d{n}
> >
> > e.g.
> >
> > \d{9}
> >
> > You can even use
> >
> > \d{1,10}
> >
> > to mean 1-10 digits.
> >
> > > Question 2:
> > > If I add a "pattern to test" is it logically AND'd to the other
> > > patterns I set up?
> >
> > Sort of - if any match fails, then it sets the response failed flag.
> >
> > > Thanks,
> > >
> > > --
> > > Ed
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
>
>
> --
> Ed
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: response assertion: 2 questions

Posted by Ed Young <ej...@SummitBid.com>.
\d{10} not quite...

\d{10} is true for any string of numeric *at least* 10 in length.

The response I'm looging for is:

1. I'm looking for a single numeric string of *exactly* 10. No more, no less.
2. Nothing else in the response.

It's simple, but I'm missing it...


On 12/4/06, sebb <se...@gmail.com> wrote:
> On 04/12/06, Ed Young <ej...@summitbid.com> wrote:
> > Question 1.
> > I'm trying to figure out how to test for a numeric value of a
> > particular character length. An example is:
> > 234335675
> > or
> > 001454668
> >
> > The easy part is the numeric check:
> > [0-9]
> > or
> > \d
> >
> > I'm not sure how to check the length part and combine it with the
> > numeric part into the regexp.
> >
> > I see that
> > {n}
> >
> > says "match exactly n times". I'm using the demo applet at:
> > http://jakarta.apache.org/oro/demo.html
> >  to test my regexps but so far no luck.
>
> \d{n}
>
> e.g.
>
> \d{9}
>
> You can even use
>
> \d{1,10}
>
> to mean 1-10 digits.
>
> > Question 2:
> > If I add a "pattern to test" is it logically AND'd to the other
> > patterns I set up?
>
> Sort of - if any match fails, then it sets the response failed flag.
>
> > Thanks,
> >
> > --
> > Ed
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>


-- 
Ed

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: response assertion: 2 questions

Posted by sebb <se...@gmail.com>.
On 04/12/06, Ed Young <ej...@summitbid.com> wrote:
> Question 1.
> I'm trying to figure out how to test for a numeric value of a
> particular character length. An example is:
> 234335675
> or
> 001454668
>
> The easy part is the numeric check:
> [0-9]
> or
> \d
>
> I'm not sure how to check the length part and combine it with the
> numeric part into the regexp.
>
> I see that
> {n}
>
> says "match exactly n times". I'm using the demo applet at:
> http://jakarta.apache.org/oro/demo.html
>  to test my regexps but so far no luck.

\d{n}

e.g.

\d{9}

You can even use

\d{1,10}

to mean 1-10 digits.

> Question 2:
> If I add a "pattern to test" is it logically AND'd to the other
> patterns I set up?

Sort of - if any match fails, then it sets the response failed flag.

> Thanks,
>
> --
> Ed
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org