Help required in regular expression in Jmeter

Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Help required in regular expression in Jmeter

Vamsi Krishna Maddali

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

Reply | Threaded
Open this post in threaded view
|

Re: Help required in regular expression in Jmeter

jmeter tea
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 <
[hidden email]> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: Help required in regular expression in Jmeter

Srikrishna Dandamraju
In reply to this post by Vamsi Krishna Maddali
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 <
[hidden email]> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: Help required in regular expression in Jmeter

Felix Schumacher
In reply to this post by Vamsi Krishna Maddali


Am 13. November 2017 08:17:42 MEZ schrieb Vamsi Krishna Maddali <[hidden email]>:

>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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Help required in regular expression in Jmeter

sebb-2-2
Note that \w == [a-zA-Z_0-9], i.e. it does not include hyphen.

On 16 November 2017 at 07:56, Felix Schumacher
<[hidden email]> wrote:

>
>
> Am 13. November 2017 08:17:42 MEZ schrieb Vamsi Krishna Maddali <[hidden email]>:
>>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: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Help required in regular expression in Jmeter

Felix Schumacher


Am 16. November 2017 12:34:15 MEZ schrieb sebb <[hidden email]>:
>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
><[hidden email]> wrote:
>>
>>
>> Am 13. November 2017 08:17:42 MEZ schrieb Vamsi Krishna Maddali
><[hidden email]>:
>>>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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Help required in regular expression in Jmeter

Vamsi Krishna Maddali
In reply to this post by jmeter tea
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 <[hidden email]>
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 <
[hidden email]> 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
>