You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by cmrz <cm...@yahoo.com> on 2009/09/29 14:41:47 UTC

using variable in a RegExp extractor

The following is a working expression  ( the snippet of the text the
expression is created for is at the bottom)

PostingGridView\$ctl(\d+).+\n.+\>111\<\/td

If I put in the batch number (111 above as an example) manually, the
expression works ( above works )

but I need it to work dynamically and get the batch number automatically.  -
I am trying to extract (\d+)

when I use the variable ${BATCH}, as in the example below the expression
does not evaluate.

PostingGridView\$ctl(\d+).+\n.+\>${BATCH}\<\/td


can you use variables in JMeter expressions??? if so what am I doing wrong
-I have verified that the variable is populated correctly by using the debug
sampler and I also use the ${BATCH} variable other places before and after
this RegExp.

If I can't is there a way for me to get around this?

Thanks!! 

Snippet of the response that the RegExp is running against:  (you can see
that '78' is the number I am trying to return based on the batch number of
'111' in this example )

<input id="PostingGridView_ctl78_CheckBox1" type="checkbox"
name="PostingGridView$ctl78$CheckBox1"
onclick="javascript:setTimeout('__doPostBack(\'PostingGridView$ctl78$CheckBox1\',\'\')',
0)" />
</td><td>111</td><td>TEST</td><td>IN
BALANCE</td><td>09/25/2009</td><td>09/25/2009</td><td style="text-

thanks again!!
-- 
View this message in context: http://www.nabble.com/using-variable-in-a-RegExp-extractor-tp25662317p25662317.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: using variable in a RegExp extractor

Posted by sebb <se...@gmail.com>.
On 29/09/2009, cmrz <cm...@yahoo.com> wrote:
>
>  The following is a working expression  ( the snippet of the text the
>  expression is created for is at the bottom)
>
>  PostingGridView\$ctl(\d+).+\n.+\>111\<\/td

You don't need to escape ">" or "<" or "/".

>  If I put in the batch number (111 above as an example) manually, the
>  expression works ( above works )
>
>  but I need it to work dynamically and get the batch number automatically.  -
>  I am trying to extract (\d+)
>
>  when I use the variable ${BATCH}, as in the example below the expression
>  does not evaluate.
>
>  PostingGridView\$ctl(\d+).+\n.+\>${BATCH}\<\/td

You don't need to escape ">" or "<" or "/".

Which version of JMeter?

Try enabling Debug for the RE Extractor - select it in the tree and
use the Help menu.

This will show the exact RE in the log file.

>
>  can you use variables in JMeter expressions??? if so what am I doing wrong
>  -I have verified that the variable is populated correctly by using the debug
>  sampler and I also use the ${BATCH} variable other places before and after
>  this RegExp.
>
>  If I can't is there a way for me to get around this?
>
>  Thanks!!
>
>  Snippet of the response that the RegExp is running against:  (you can see
>  that '78' is the number I am trying to return based on the batch number of
>  '111' in this example )
>
>  <input id="PostingGridView_ctl78_CheckBox1" type="checkbox"
>  name="PostingGridView$ctl78$CheckBox1"
>  onclick="javascript:setTimeout('__doPostBack(\'PostingGridView$ctl78$CheckBox1\',\'\')',
>  0)" />
>  </td><td>111</td><td>TEST</td><td>IN
>  BALANCE</td><td>09/25/2009</td><td>09/25/2009</td><td style="text-
>
>  thanks again!!
>
> --
>  View this message in context: http://www.nabble.com/using-variable-in-a-RegExp-extractor-tp25662317p25662317.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


Re: using variable in a RegExp extractor

Posted by sebb <se...@gmail.com>.
On 29/09/2009, cmrz <cm...@yahoo.com> wrote:
>
>  my updated regular expression is:  PostingGridView\$ctl(\d+).+\n.+${BATCH}
>
>  this once again works if I use a number in place of the ${BATCH} variable.
>
>  I have no doubt that the expression is working - I even tried it inside a
>  Perl script I wrote up for this and it worked fine using the variable.  so
>  it is some way JMeter is handling or not handling this expression.
>
>  I am using Jmeter v. 2.3.4 downloaded 1 hour ago from their main site and
>  still the same problem.
>
>  please help !

What does the JMeter log file show when you enable Debug on the RE Extractor?

> --
>  View this message in context: http://www.nabble.com/using-variable-in-a-RegExp-extractor-tp25662317p25665882.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


Re: using variable in a RegExp extractor

Posted by cmrz <cm...@yahoo.com>.
my updated regular expression is:  PostingGridView\$ctl(\d+).+\n.+${BATCH}

this once again works if I use a number in place of the ${BATCH} variable. 

I have no doubt that the expression is working - I even tried it inside a
Perl script I wrote up for this and it worked fine using the variable.  so
it is some way JMeter is handling or not handling this expression. 

I am using Jmeter v. 2.3.4 downloaded 1 hour ago from their main site and
still the same problem. 

please help ! 
-- 
View this message in context: http://www.nabble.com/using-variable-in-a-RegExp-extractor-tp25662317p25665882.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: using variable in a RegExp extractor

Posted by sebb <se...@gmail.com>.
On 02/10/2009, cmrz <cm...@yahoo.com> wrote:
>
>
>  THAT WORKED !!!!   thank you!
>
>  can you please tell me why that worked ?  what does adding the extra \ do?

When parsing the string for function references, certain characters
(such as $) are treated specially. E.g. if one wants to enter the
string ${X} and not have it treated as a variable reference, it needs
to be entered as \${X}. However the \ must then be removed. Using \\$
means that the final string will contain \$.

If the string does not contain any function/variable references, it is
used as is.


>  thanks again!!
>
>
>
>  > You may be able to solve the problem by using the following RE:
>  >
>  > PostingGridView\\$ctl(\d+).+\n.+${BATCH}
>  >
>  > i.e. try \\ before $ instead of just \.
>
>
>  --
>
> View this message in context: http://www.nabble.com/using-variable-in-a-RegExp-extractor-tp25662317p25721227.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


Re: using variable in a RegExp extractor

Posted by cmrz <cm...@yahoo.com>.

THAT WORKED !!!!   thank you!

can you please tell me why that worked ?  what does adding the extra \ do?

thanks again!! 


> You may be able to solve the problem by using the following RE:
>
> PostingGridView\\$ctl(\d+).+\n.+${BATCH}
>
> i.e. try \\ before $ instead of just \.


-- 
View this message in context: http://www.nabble.com/using-variable-in-a-RegExp-extractor-tp25662317p25721227.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: using variable in a RegExp extractor

Posted by sebb <se...@gmail.com>.
On 30/09/2009, cmrz <cm...@yahoo.com> wrote:
>
>  I can't get the debug working right.  Enabling debug does not seem to do
>  anything and I am not sure how to get this log file.
>
>  Can you let me know how to do this and I will move forward?
>  thanks!
>

"Try enabling Debug for the RE Extractor - select it in the tree and
use the Help menu."

The debug messages are written to the jmeter.log file.

You may be able to solve the problem by using the following RE:

PostingGridView\\$ctl(\d+).+\n.+${BATCH}

i.e. try \\ before $ instead of just \.

> --
>  View this message in context: http://www.nabble.com/using-variable-in-a-RegExp-extractor-tp25662317p25682417.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


Re: using variable in a RegExp extractor

Posted by cmrz <cm...@yahoo.com>.
I can't get the debug working right.  Enabling debug does not seem to do
anything and I am not sure how to get this log file. 

Can you let me know how to do this and I will move forward? 
thanks!
-- 
View this message in context: http://www.nabble.com/using-variable-in-a-RegExp-extractor-tp25662317p25682417.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