You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Vamsi Krishna Maddali <va...@qolsys.com> on 2017/11/13 07:17:42 UTC

Help required in regular expression in Jmeter

Hi All,


Required your help in resloving below issue:


Issue:Unable to capture the authenticate?code value which is generated while logging in to a webpage, authenticate?code value which is being generated is a dynamic value and not following a unique pattarn as in a regular expression kind.


What i am trying to do here is capturing the authenticate?code value into a variable named “token” by using the “Regular Expression Extractor” and use that variable in the login script which is used to access the webpage. But the authenticate?code is not being captured in the script and i am not able to use in the login script.


My guess is that the Regular Expression Extractor which i am using may not be the correct one, so couldn't capture the authenticate?code value .


Can anyone help me in finding a soluion or any other method to handel this situation.


Below is the HTML tag in webpage:


<form id="kc-form-login" class="" action="http://localhost:8080/auth/realms/master/login-actions/authenticate?code=u22yiDCDtV-jm3_1w2NP6HykFCTtePlgADFhFa17U3s&execution=570368df-fa0b-4bd1-9964-251d1448718e&client_id=security-admin-console" method="post">


in the below , we are trying to capture “authenticate?code=u22yiDCDtV-jm3_1w2NP6HykFCTtePlgADFhFa17U3s” value and need to send as a parameter in next “Sample Controller”.



[cid:28bd9a2c-d267-4bcc-83c7-62b255416835]



Thanks,

Vamsi

Re: Help required in regular expression in Jmeter

Posted by Vamsi Krishna Maddali <va...@qolsys.com>.
Thanks a lot guys, we are able to resolve this issue.


https://regex101.com/r/eNSsrl/1  - Link helps us very much.


Thanks,

Vamsi.

________________________________
From: jmeter tea <jm...@gmail.com>
Sent: 13 November 2017 13:06:12
To: JMeter Users List
Subject: Re: Help required in regular expression in Jmeter

You can use the Regular Expression: login-actions\/([^&]*)
See https://regex101.com/r/eNSsrl/1

On Mon, Nov 13, 2017 at 9:17 AM, Vamsi Krishna Maddali <
vamsi.maddali@qolsys.com> wrote:

> Hi All,
>
>
> Required your help in resloving below issue:
>
>
> Issue:Unable to capture the authenticate?code value which is generated
> while logging in to a webpage, authenticate?code value which is being
> generated is a dynamic value and not following a unique pattarn as in a
> regular expression kind.
>
>
> What i am trying to do here is capturing the authenticate?code value into
> a variable named “token” by using the “Regular Expression Extractor” and
> use that variable in the login script which is used to access the webpage.
> But the authenticate?code is not being captured in the script and i am not
> able to use in the login script.
>
>
> My guess is that the Regular Expression Extractor which i am using may not
> be the correct one, so couldn't capture the authenticate?code value .
>
>
> Can anyone help me in finding a soluion or any other method to handel this
> situation.
>
>
> Below is the HTML tag in webpage:
>
>
> <form id="kc-form-login" class="" action="http://localhost:8080/
> auth/realms/master/login-actions/authenticate?code=u22yiDCDtV-jm3_
> 1w2NP6HykFCTtePlgADFhFa17U3s&execution=570368df-fa0b-4bd1-
> 9964-251d1448718e&client_id=security-admin-console" method="post">
>
>
> in the below , we are trying to capture “authenticate?code=u22yiDCDtV-jm3_1w2NP6HykFCTtePlgADFhFa17U3s”
> value and need to send as a parameter in next “Sample Controller”.
>
>
>
>
>
> Thanks,
>
> Vamsi
>

Re: Help required in regular expression in Jmeter

Posted by jmeter tea <jm...@gmail.com>.
You can use the Regular Expression: login-actions\/([^&]*)
See https://regex101.com/r/eNSsrl/1

On Mon, Nov 13, 2017 at 9:17 AM, Vamsi Krishna Maddali <
vamsi.maddali@qolsys.com> wrote:

> Hi All,
>
>
> Required your help in resloving below issue:
>
>
> Issue:Unable to capture the authenticate?code value which is generated
> while logging in to a webpage, authenticate?code value which is being
> generated is a dynamic value and not following a unique pattarn as in a
> regular expression kind.
>
>
> What i am trying to do here is capturing the authenticate?code value into
> a variable named “token” by using the “Regular Expression Extractor” and
> use that variable in the login script which is used to access the webpage.
> But the authenticate?code is not being captured in the script and i am not
> able to use in the login script.
>
>
> My guess is that the Regular Expression Extractor which i am using may not
> be the correct one, so couldn't capture the authenticate?code value .
>
>
> Can anyone help me in finding a soluion or any other method to handel this
> situation.
>
>
> Below is the HTML tag in webpage:
>
>
> <form id="kc-form-login" class="" action="http://localhost:8080/
> auth/realms/master/login-actions/authenticate?code=u22yiDCDtV-jm3_
> 1w2NP6HykFCTtePlgADFhFa17U3s&execution=570368df-fa0b-4bd1-
> 9964-251d1448718e&client_id=security-admin-console" method="post">
>
>
> in the below , we are trying to capture “authenticate?code=u22yiDCDtV-jm3_1w2NP6HykFCTtePlgADFhFa17U3s”
> value and need to send as a parameter in next “Sample Controller”.
>
>
>
>
>
> Thanks,
>
> Vamsi
>

Re: Help required in regular expression in Jmeter

Posted by Srikrishna Dandamraju <sk...@gmail.com>.
Hi Vamsi,

Please try below  RegEx coreelation

code=(\S)&
for sure you will get if not please let me know.

Thanks
Srikrishna.D


On Mon, Nov 13, 2017 at 12:47 PM, Vamsi Krishna Maddali <
vamsi.maddali@qolsys.com> wrote:

> Hi All,
>
>
> Required your help in resloving below issue:
>
>
> Issue:Unable to capture the authenticate?code value which is generated
> while logging in to a webpage, authenticate?code value which is being
> generated is a dynamic value and not following a unique pattarn as in a
> regular expression kind.
>
>
> What i am trying to do here is capturing the authenticate?code value into
> a variable named “token” by using the “Regular Expression Extractor” and
> use that variable in the login script which is used to access the webpage.
> But the authenticate?code is not being captured in the script and i am not
> able to use in the login script.
>
>
> My guess is that the Regular Expression Extractor which i am using may not
> be the correct one, so couldn't capture the authenticate?code value .
>
>
> Can anyone help me in finding a soluion or any other method to handel this
> situation.
>
>
> Below is the HTML tag in webpage:
>
>
> <form id="kc-form-login" class="" action="http://localhost:8080/
> auth/realms/master/login-actions/authenticate?code=u22yiDCDtV-jm3_
> 1w2NP6HykFCTtePlgADFhFa17U3s&execution=570368df-fa0b-4bd1-
> 9964-251d1448718e&client_id=security-admin-console" method="post">
>
>
> in the below , we are trying to capture “authenticate?code=u22yiDCDtV-jm3_1w2NP6HykFCTtePlgADFhFa17U3s”
> value and need to send as a parameter in next “Sample Controller”.
>
>
>
>
>
> Thanks,
>
> Vamsi
>

Re: Help required in regular expression in Jmeter

Posted by Felix Schumacher <fe...@internetallee.de>.

Am 16. November 2017 12:34:15 MEZ schrieb sebb <se...@gmail.com>:
>Note that \w == [a-zA-Z_0-9], i.e. it does not include hyphen.

Good catch. 

Felix

>
>On 16 November 2017 at 07:56, Felix Schumacher
><fe...@internetallee.de> wrote:
>>
>>
>> Am 13. November 2017 08:17:42 MEZ schrieb Vamsi Krishna Maddali
><va...@qolsys.com>:
>>>Hi All,
>>>
>>>
>>>Required your help in resloving below issue:
>>>
>>>
>>>Issue:Unable to capture the authenticate?code value which is
>generated
>>>while logging in to a webpage, authenticate?code value which is being
>>>generated is a dynamic value and not following a unique pattarn as in
>a
>>>regular expression kind.
>>>
>>>
>>>What i am trying to do here is capturing the authenticate?code value
>>>into a variable named “token” by using the “Regular Expression
>>>Extractor” and use that variable in the login script which is used to
>>>access the webpage. But the authenticate?code is not being captured
>in
>>>the script and i am not able to use in the login script.
>>>
>>>
>>>My guess is that the Regular Expression Extractor which i am using
>may
>>>not be the correct one, so couldn't capture the authenticate?code
>value
>>>.
>>>
>>>
>>>Can anyone help me in finding a soluion or any other method to handel
>>>this situation.
>>>
>>>
>>>Below is the HTML tag in webpage:
>>>
>>>
>>><form id="kc-form-login" class=""
>>>action="http://localhost:8080/auth/realms/master/login-actions/authenticate?code=u22yiDCDtV-jm3_1w2NP6HykFCTtePlgADFhFa17U3s&execution=570368df-fa0b-4bd1-9964-251d1448718e&client_id=security-admin-console"
>>>method="post">
>>
>> The token seems to consist of the characters a to z, A to Z, digits,
>dash and underscore. You can combine those characters into one
>character class using [a-zA-Z0-9_-] for usage in a regex.
>>
>> This an be used to extract the token using a regex like
>>
>> code=([a-zA-Z0-9_-]*)
>>
>> The character class could probably be shortened to
>>
>> [\w\d]
>>
>> Or written as a blacklist
>>
>> [^;&\s#"']
>>
>> Regards,
>> Felix
>>
>>>
>>>
>>>in the below , we are trying to capture
>>>“authenticate?code=u22yiDCDtV-jm3_1w2NP6HykFCTtePlgADFhFa17U3s” value
>>>and need to send as a parameter in next “Sample Controller”.
>>>
>>>
>>>
>>>[cid:28bd9a2c-d267-4bcc-83c7-62b255416835]
>>>
>>>
>>>
>>>Thanks,
>>>
>>>Vamsi
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> For additional commands, e-mail: user-help@jmeter.apache.org
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>For additional commands, e-mail: user-help@jmeter.apache.org

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


Re: Help required in regular expression in Jmeter

Posted by sebb <se...@gmail.com>.
Note that \w == [a-zA-Z_0-9], i.e. it does not include hyphen.

On 16 November 2017 at 07:56, Felix Schumacher
<fe...@internetallee.de> wrote:
>
>
> Am 13. November 2017 08:17:42 MEZ schrieb Vamsi Krishna Maddali <va...@qolsys.com>:
>>Hi All,
>>
>>
>>Required your help in resloving below issue:
>>
>>
>>Issue:Unable to capture the authenticate?code value which is generated
>>while logging in to a webpage, authenticate?code value which is being
>>generated is a dynamic value and not following a unique pattarn as in a
>>regular expression kind.
>>
>>
>>What i am trying to do here is capturing the authenticate?code value
>>into a variable named “token” by using the “Regular Expression
>>Extractor” and use that variable in the login script which is used to
>>access the webpage. But the authenticate?code is not being captured in
>>the script and i am not able to use in the login script.
>>
>>
>>My guess is that the Regular Expression Extractor which i am using may
>>not be the correct one, so couldn't capture the authenticate?code value
>>.
>>
>>
>>Can anyone help me in finding a soluion or any other method to handel
>>this situation.
>>
>>
>>Below is the HTML tag in webpage:
>>
>>
>><form id="kc-form-login" class=""
>>action="http://localhost:8080/auth/realms/master/login-actions/authenticate?code=u22yiDCDtV-jm3_1w2NP6HykFCTtePlgADFhFa17U3s&execution=570368df-fa0b-4bd1-9964-251d1448718e&client_id=security-admin-console"
>>method="post">
>
> The token seems to consist of the characters a to z, A to Z, digits, dash and underscore. You can combine those characters into one character class using [a-zA-Z0-9_-] for usage in a regex.
>
> This an be used to extract the token using a regex like
>
> code=([a-zA-Z0-9_-]*)
>
> The character class could probably be shortened to
>
> [\w\d]
>
> Or written as a blacklist
>
> [^;&\s#"']
>
> Regards,
> Felix
>
>>
>>
>>in the below , we are trying to capture
>>“authenticate?code=u22yiDCDtV-jm3_1w2NP6HykFCTtePlgADFhFa17U3s” value
>>and need to send as a parameter in next “Sample Controller”.
>>
>>
>>
>>[cid:28bd9a2c-d267-4bcc-83c7-62b255416835]
>>
>>
>>
>>Thanks,
>>
>>Vamsi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>

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


Re: Help required in regular expression in Jmeter

Posted by Felix Schumacher <fe...@internetallee.de>.

Am 13. November 2017 08:17:42 MEZ schrieb Vamsi Krishna Maddali <va...@qolsys.com>:
>Hi All,
>
>
>Required your help in resloving below issue:
>
>
>Issue:Unable to capture the authenticate?code value which is generated
>while logging in to a webpage, authenticate?code value which is being
>generated is a dynamic value and not following a unique pattarn as in a
>regular expression kind.
>
>
>What i am trying to do here is capturing the authenticate?code value
>into a variable named “token” by using the “Regular Expression
>Extractor” and use that variable in the login script which is used to
>access the webpage. But the authenticate?code is not being captured in
>the script and i am not able to use in the login script.
>
>
>My guess is that the Regular Expression Extractor which i am using may
>not be the correct one, so couldn't capture the authenticate?code value
>.
>
>
>Can anyone help me in finding a soluion or any other method to handel
>this situation.
>
>
>Below is the HTML tag in webpage:
>
>
><form id="kc-form-login" class=""
>action="http://localhost:8080/auth/realms/master/login-actions/authenticate?code=u22yiDCDtV-jm3_1w2NP6HykFCTtePlgADFhFa17U3s&execution=570368df-fa0b-4bd1-9964-251d1448718e&client_id=security-admin-console"
>method="post">

The token seems to consist of the characters a to z, A to Z, digits, dash and underscore. You can combine those characters into one character class using [a-zA-Z0-9_-] for usage in a regex. 

This an be used to extract the token using a regex like 

code=([a-zA-Z0-9_-]*) 

The character class could probably be shortened to

[\w\d] 

Or written as a blacklist

[^;&\s#"'] 

Regards, 
Felix 

>
>
>in the below , we are trying to capture
>“authenticate?code=u22yiDCDtV-jm3_1w2NP6HykFCTtePlgADFhFa17U3s” value
>and need to send as a parameter in next “Sample Controller”.
>
>
>
>[cid:28bd9a2c-d267-4bcc-83c7-62b255416835]
>
>
>
>Thanks,
>
>Vamsi

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