You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Massas <mu...@hotmail.com> on 2008/11/12 12:54:42 UTC

Another RegEx Extractor question.

Hi!

I'm trying to use the regular expression extractor in order store a response
message in a variable, which i later want to use in a http sampler. 

It feels like I've tried almost everything, but I fail to get the variable
to other than the default value.
The response message i want to parse is in this format:
4;1aa899f6-73f5-473f-bea4-e102b4366da5;
I want to extract the stuff between the semi colons, and it will always be
at this format. I use the following in the  RE-field:
".{8,8}-.{4,4}-.{4,4}-.{4,4}-.{12,12}"
I've also tried various approaches here, with name and value, parenthesis
for grouping etc, but i always get the default value in my reference
variable. 

The RE matches what i want when i test it in various web-applications but am
not sure i'm using the extractor correctly (new jMeter user)?

I've also tried adressing the reference name with _g0 and _g1 etc, but that
doesn't even get the default value.



Help would be highly appreciated!

regards, Mats
-- 
View this message in context: http://www.nabble.com/Another-RegEx-Extractor-question.-tp20458864p20458864.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: Another RegEx Extractor question.

Posted by Massas <mu...@hotmail.com>.

sebb-2-2 wrote:
> 
> On 12/11/2008, Sipathamandla <si...@gmail.com> wrote:
>> Just tried ur regex pattern, it matches all between characters between
>>  the semi colons.
>>
>>
>>  > I've also tried various approaches here, with name and value,
>> parenthesis
>>  > for grouping etc, but i always get the default value in my reference
>>  > variable.
> 
> That means the RE did not match.
> It is not affected by grouping brackets.
> 
> I just tried the RE and it works for me, so there must be a typo in
> it, e.g. trailing space?
> 
>>
>> you must have at least one set of parenthesis.
>> 
>> (http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Regular_Expression_Extractor)
> 
> Parentheses are not needed if you use $0$ to return whatever the full
> RE matches.
> 
> In this case, it might be safer to add ; around the group:
> 
>>  regex:      (.{8,8}-.{4,4}-.{4,4}-.{4,4}-.{12,12})
> 
> regex:      ;(.{8,8}-.{4,4}-.{4,4}-.{4,4}-.{12,12});
> 
>>  template: $1$
> 
> in which case $0$ would include the ;;, so the group is needed here.
> 
>>  match:     1
>>
>>  retrieved using ${refName} (didn't specify grouping)
>>
>>
>>
> 
> You can test REs using the online ORO demo:
> 
> http://jakarta.apache.org/oro/demo.html
> 
> Or using a simple test plan with Java Request (put data in ResultData)
> and RE Post-Processor, Debug Sampler and View Results Tree.
>  
> ____________________________________________________________________________________________
>>
>>
>>
>>
>>  2008/11/12 Massas <mu...@hotmail.com>:
>>
>> >
>>  > Hi!
>>  >
>>  > I'm trying to use the regular expression extractor in order store a
>> response
>>  > message in a variable, which i later want to use in a http sampler.
>>  >
>>  > It feels like I've tried almost everything, but I fail to get the
>> variable
>>  > to other than the default value.
>>  > The response message i want to parse is in this format:
>>  > 4;1aa899f6-73f5-473f-bea4-e102b4366da5;
>>  > I want to extract the stuff between the semi colons, and it will
>> always be
>>  > at this format. I use the following in the  RE-field:
>>  > ".{8,8}-.{4,4}-.{4,4}-.{4,4}-.{12,12}"
>>  > I've also tried various approaches here, with name and value,
>> parenthesis
>>  > for grouping etc, but i always get the default value in my reference
>>  > variable.
>>  >
>>  > The RE matches what i want when i test it in various web-applications
>> but am
>>  > not sure i'm using the extractor correctly (new jMeter user)?
>>  >
>>  > I've also tried adressing the reference name with _g0 and _g1 etc, but
>> that
>>  > doesn't even get the default value.
>>  >
>>  >
>>  >
>>  > Help would be highly appreciated!
>>  >
>>  > regards, Mats
>>  > --
>>  > View this message in context:
>> http://www.nabble.com/Another-RegEx-Extractor-question.-tp20458864p20458864.html
>>  > Sent from the JMeter - User mailing list archive at Nabble.com.
>>  >
>>  >
>>  > ---------------------------------------------------------------------
>>  > 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
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
> 
> 
Thank you for your replies. I think i had some 'bad luck' when thinking on
this problem. 
Now, when i parse the whole response, instead of just the part i needed it
works like a charm.

happy happy! 

Again, thanks.

regards, Mats 

-- 
View this message in context: http://www.nabble.com/Another-RegEx-Extractor-question.-tp20458864p20459931.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: Another RegEx Extractor question.

Posted by sebb <se...@gmail.com>.
On 12/11/2008, Sipathamandla <si...@gmail.com> wrote:
> Just tried ur regex pattern, it matches all between characters between
>  the semi colons.
>
>
>  > I've also tried various approaches here, with name and value, parenthesis
>  > for grouping etc, but i always get the default value in my reference
>  > variable.

That means the RE did not match.
It is not affected by grouping brackets.

I just tried the RE and it works for me, so there must be a typo in
it, e.g. trailing space?

>
> you must have at least one set of parenthesis.
>  (http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Regular_Expression_Extractor)

Parentheses are not needed if you use $0$ to return whatever the full
RE matches.

In this case, it might be safer to add ; around the group:

>  regex:      (.{8,8}-.{4,4}-.{4,4}-.{4,4}-.{12,12})

regex:      ;(.{8,8}-.{4,4}-.{4,4}-.{4,4}-.{12,12});

>  template: $1$

in which case $0$ would include the ;;, so the group is needed here.

>  match:     1
>
>  retrieved using ${refName} (didn't specify grouping)
>
>
>

You can test REs using the online ORO demo:

http://jakarta.apache.org/oro/demo.html

Or using a simple test plan with Java Request (put data in ResultData)
and RE Post-Processor, Debug Sampler and View Results Tree.
  ____________________________________________________________________________________________
>
>
>
>
>  2008/11/12 Massas <mu...@hotmail.com>:
>
> >
>  > Hi!
>  >
>  > I'm trying to use the regular expression extractor in order store a response
>  > message in a variable, which i later want to use in a http sampler.
>  >
>  > It feels like I've tried almost everything, but I fail to get the variable
>  > to other than the default value.
>  > The response message i want to parse is in this format:
>  > 4;1aa899f6-73f5-473f-bea4-e102b4366da5;
>  > I want to extract the stuff between the semi colons, and it will always be
>  > at this format. I use the following in the  RE-field:
>  > ".{8,8}-.{4,4}-.{4,4}-.{4,4}-.{12,12}"
>  > I've also tried various approaches here, with name and value, parenthesis
>  > for grouping etc, but i always get the default value in my reference
>  > variable.
>  >
>  > The RE matches what i want when i test it in various web-applications but am
>  > not sure i'm using the extractor correctly (new jMeter user)?
>  >
>  > I've also tried adressing the reference name with _g0 and _g1 etc, but that
>  > doesn't even get the default value.
>  >
>  >
>  >
>  > Help would be highly appreciated!
>  >
>  > regards, Mats
>  > --
>  > View this message in context: http://www.nabble.com/Another-RegEx-Extractor-question.-tp20458864p20458864.html
>  > Sent from the JMeter - User mailing list archive at Nabble.com.
>  >
>  >
>  > ---------------------------------------------------------------------
>  > 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
>
>

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


Re: Another RegEx Extractor question.

Posted by Sipathamandla <si...@gmail.com>.
Just tried ur regex pattern, it matches all between characters between
the semi colons.

> I've also tried various approaches here, with name and value, parenthesis
> for grouping etc, but i always get the default value in my reference
> variable.

you must have at least one set of parenthesis.
(http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Regular_Expression_Extractor)

regex:      (.{8,8}-.{4,4}-.{4,4}-.{4,4}-.{12,12})
template: $1$
match:     1

retrieved using ${refName} (didn't specify grouping)



____________________________________________________________________________________________




2008/11/12 Massas <mu...@hotmail.com>:
>
> Hi!
>
> I'm trying to use the regular expression extractor in order store a response
> message in a variable, which i later want to use in a http sampler.
>
> It feels like I've tried almost everything, but I fail to get the variable
> to other than the default value.
> The response message i want to parse is in this format:
> 4;1aa899f6-73f5-473f-bea4-e102b4366da5;
> I want to extract the stuff between the semi colons, and it will always be
> at this format. I use the following in the  RE-field:
> ".{8,8}-.{4,4}-.{4,4}-.{4,4}-.{12,12}"
> I've also tried various approaches here, with name and value, parenthesis
> for grouping etc, but i always get the default value in my reference
> variable.
>
> The RE matches what i want when i test it in various web-applications but am
> not sure i'm using the extractor correctly (new jMeter user)?
>
> I've also tried adressing the reference name with _g0 and _g1 etc, but that
> doesn't even get the default value.
>
>
>
> Help would be highly appreciated!
>
> regards, Mats
> --
> View this message in context: http://www.nabble.com/Another-RegEx-Extractor-question.-tp20458864p20458864.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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