You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Nop Lists <no...@gmail.com> on 2005/08/03 15:24:24 UTC

Regular expression extractor / multiline matching

Hello,
I'm trying to extract the selcted value of a selction box in a form,
which looks like this

<select name="orderData.secAccountId" tabindex="3"
onchange="errorMsg('datenInkonsistenz')" style="z-index:1"
class="input150px"><option value="789123456700"
selected="selected">789 1234567 00</option>
<option value="789123456701">789 1234567 01</option>
<option value="789123456799">789 1234567 99</option></select>

Under the HTTP Request Sampler I use a regular
expression extractor with the following parameter:

Reference Name:		secAccountId
Regular Expression:	(?s) (<select
name="orderData.secAccountId"(.*)<option value="([0-9]*)"
selected="selected">)
Template:		$2$
Match No.:		1
Default Value:		NOTFOUND

Instead of the value "789123456700" the variable secAccountId has the
value "null".

Does anybody have an idea what I am doing wrong?
Thanks a lot!
nop

Re: Regular expression extractor / multiline matching

Posted by sebb <se...@gmail.com>.
On 03/08/05, Nop Lists <no...@gmail.com> wrote:
> Thanks, Sebb, the following works like charm:
> RegExp: (?s)(<select name="orderData.secAccountId".*?<option
> value="([0-9]*)" selected="selected">)

([0-9]+) would be better, unless you want to match value=""

> Template: $2$
> 
> However I am a bit confused about numbering the template.
> My understanding is:
> $1$ is what matched starting at <select and ending at selected">

Yes.

In this case it is the same as $0$, because you have enclosed the whole Regex.

So you could drop the outer parentheses and use $1$ instead.

> .*? is not counted as it is not in paranthesis.

Not any more - but previously it _was_ in parentheses.

> $2$ is what matched with ([0-9]*)

Yes, now that (.*) has become .*?

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


Re: Regular expression extractor / multiline matching

Posted by Nop Lists <no...@gmail.com>.
Thanks, Sebb, the following works like charm:
RegExp: (?s)(<select name="orderData.secAccountId".*?<option 
value="([0-9]*)" selected="selected">)
Template: $2$

However I am a bit confused about numbering the template.
My understanding is:
$1$ is what matched starting at <select and ending at selected">
.*? is not counted as it is not in paranthesis.
$2$ is what matched with ([0-9]*)

Is this correct?

Thanks
Nop

On 8/3/05, sebb <se...@gmail.com> wrote:
> 
> On 03/08/05, Nop Lists <no...@gmail.com> wrote:
> > Hello,
> > I'm trying to extract the selcted value of a selction box in a form,
> > which looks like this
> >
> > <select name="orderData.secAccountId" tabindex="3"
> > onchange="errorMsg('datenInkonsistenz')" style="z-index:1"
> > class="input150px"><option value="789123456700"
> > selected="selected">789 1234567 00</option>
> > <option value="789123456701">789 1234567 01</option>
> > <option value="789123456799">789 1234567 99</option></select>
> >
> > Under the HTTP Request Sampler I use a regular
> > expression extractor with the following parameter:
> >
> > Reference Name: secAccountId
> > Regular Expression: (?s) (<select
> > name="orderData.secAccountId"(.*)<option value="([0-9]*)"
> > selected="selected">)
> 
> .* is greedy and may match more than you intended.
> 
> Use (.*?) or perhaps ([^<]*) instead
> 
> And if you don't want to use groups 1 and 2, why collect them?
> 
> Should probably be using .+ and [0-9]+ anyway ...
> 
> > Template: $2$
> 
> This corresponds to (.*), not ([0-9]*)
> 
> You need to use $3$ or remove the other brackets.
> 
> > Match No.: 1
> > Default Value: NOTFOUND
> >
> > Instead of the value "789123456700" the variable secAccountId has the
> > value "null".
> >
> > Does anybody have an idea what I am doing wrong?
> 
> See above.
> 
> See also the Regex FAQ: 
> http://wiki.apache.org/jakarta-jmeter/RegularExpressions
> 
> S.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
>

Re: Regular expression extractor / multiline matching

Posted by sebb <se...@gmail.com>.
On 03/08/05, Nop Lists <no...@gmail.com> wrote:
> Hello,
> I'm trying to extract the selcted value of a selction box in a form,
> which looks like this
> 
> <select name="orderData.secAccountId" tabindex="3"
> onchange="errorMsg('datenInkonsistenz')" style="z-index:1"
> class="input150px"><option value="789123456700"
> selected="selected">789 1234567 00</option>
> <option value="789123456701">789 1234567 01</option>
> <option value="789123456799">789 1234567 99</option></select>
> 
> Under the HTTP Request Sampler I use a regular
> expression extractor with the following parameter:
> 
> Reference Name:         secAccountId
> Regular Expression:     (?s) (<select
> name="orderData.secAccountId"(.*)<option value="([0-9]*)"
> selected="selected">)

.* is greedy and may match more than you intended.

Use (.*?) or perhaps ([^<]*) instead

And if you don't want to use groups 1 and 2, why collect them?

Should probably be using .+ and [0-9]+ anyway ...

> Template:               $2$

This corresponds to (.*), not ([0-9]*)

You need to use $3$ or remove the other brackets.

> Match No.:              1
> Default Value:          NOTFOUND
> 
> Instead of the value "789123456700" the variable secAccountId has the
> value "null".
> 
> Does anybody have an idea what I am doing wrong?

See above. 

See also the Regex FAQ: http://wiki.apache.org/jakarta-jmeter/RegularExpressions

S.

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


Re: Performance testing Glue Web Services

Posted by Peter Lin <wo...@gmail.com>.
I did test the webservice sampler against glue and it worked. 

peter

On 8/3/05, Manish Mathuria <mm...@infostretch.com> wrote:
> 
> Hi
> 
> I am new to JMeter.
> 
> I want to know if JMeter would work for Glue web services. We are using Glue
> to convert our java interfaces to web services and need to performance test
> them.
> 
> Any experience/advice/prior knowledge on this is much appreciated.
> 
> Thanks
> 
> Manish
> 
> 
> ---------------------------------------------------------------------
> 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


Performance testing Glue Web Services

Posted by Manish Mathuria <mm...@infostretch.com>.
Hi

I am new to JMeter. 

I want to know if JMeter would work for Glue web services. We are using Glue
to convert our java interfaces to web services and need to performance test
them.

Any experience/advice/prior knowledge on this is much appreciated.

Thanks

Manish


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