You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by ramnik <rk...@jaspersoft.com> on 2009/09/11 21:26:36 UTC
Jmeter - regex expression for variable from script
Hello,
I m using Jmeter for Performance Testing and facing issue with extracting
the variable using REGEX extractor.
Code -
<script id="baseState">
clientKey = clientKey || "123844275807432328";
I used teh regex - \clientKey \ || \ (.+\d) to extract the client key
But, this is not working as it is returning null as value of expression.
Can anybody please help me ?
--
View this message in context: http://www.nabble.com/Jmeter---regex-expression-for-variable-from-script-tp25406993p25406993.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: Jmeter - regex expression for variable from script
Posted by sebb <se...@gmail.com>.
On 11/09/2009, Deepak Shetty <sh...@gmail.com> wrote:
> Hi
> as pointed out by sebb the greedy quantifiers are ineffecient (\d+? )
> You should probably use something like (\d+[^"])
Not in this case - there's no backtracking involved, because \d+ stops
as soon as a non-digit is found.
The inefficiency comes when the greedy quantifier can match more than
is necessary, but that cannot happen here.
In this case, the ? is not necessary, because \d+ cannot grab more
than it should.
There's also a missing \ before the second |.
> You should also consider making your regexes more resilient to change (it
> would break if i enter a space between the = sign which is still valid
> javascript...)
> regards
>
> deepak
>
>
> On Fri, Sep 11, 2009 at 3:33 PM, ramnik <rk...@jaspersoft.com> wrote:
>
> >
> >
> > Finally , i m able to find the right expression :)
> >
> > Regex - clientKey =clientKey\||"(\d+?)";
> >
> > worked perfectly for me ..
> >
> > thanks Alex for ur response
> >
> >
> >
> >
> > ramnik wrote:
> > >
> > > thanks for quick response ..
> > >
> > > i will give it a try now ..:)
> > >
> > >
> > > Alexandru Rotaru wrote:
> > >>
> > >> you can take a look at http://jakarta.apache.org/oro/demo.html
> > >> I think it is a good tool to try you reg exps.
> > >>
> > >> for your case, I think you need clientKey \|\| "(.+\d)"
> > >>
> > >> Alex
> > >>
> > >> On Sep 11, 2009, at 10:26 PM, ramnik wrote:
> > >>
> > >>>
> > >>> Hello,
> > >>>
> > >>> I m using Jmeter for Performance Testing and facing issue with
> > >>> extracting
> > >>> the variable using REGEX extractor.
> > >>>
> > >>> Code -
> > >>> <script id="baseState">
> > >>> clientKey = clientKey || "123844275807432328";
> > >>>
> > >>> I used teh regex - \clientKey \ || \ (.+\d) to extract the client key
> > >>>
> > >>> But, this is not working as it is returning null as value of
> > >>> expression.
> > >>>
> > >>> Can anybody please help me ?
> > >>> --
> > >>> View this message in context:
> > >>>
> > http://www.nabble.com/Jmeter---regex-expression-for-variable-from-script-tp25406993p25406993.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
> > >>>
> > >>
> > >>
> > >>
> > >
> > >
> >
> > --
> > View this message in context:
> > http://www.nabble.com/Jmeter---regex-expression-for-variable-from-script-tp25406993p25409406.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: Jmeter - regex expression for variable from script
Posted by Deepak Shetty <sh...@gmail.com>.
Hi
as pointed out by sebb the greedy quantifiers are ineffecient (\d+? )
You should probably use something like (\d+[^"])
You should also consider making your regexes more resilient to change (it
would break if i enter a space between the = sign which is still valid
javascript...)
regards
deepak
On Fri, Sep 11, 2009 at 3:33 PM, ramnik <rk...@jaspersoft.com> wrote:
>
>
> Finally , i m able to find the right expression :)
>
> Regex - clientKey =clientKey\||"(\d+?)";
>
> worked perfectly for me ..
>
> thanks Alex for ur response
>
>
>
>
> ramnik wrote:
> >
> > thanks for quick response ..
> >
> > i will give it a try now ..:)
> >
> >
> > Alexandru Rotaru wrote:
> >>
> >> you can take a look at http://jakarta.apache.org/oro/demo.html
> >> I think it is a good tool to try you reg exps.
> >>
> >> for your case, I think you need clientKey \|\| "(.+\d)"
> >>
> >> Alex
> >>
> >> On Sep 11, 2009, at 10:26 PM, ramnik wrote:
> >>
> >>>
> >>> Hello,
> >>>
> >>> I m using Jmeter for Performance Testing and facing issue with
> >>> extracting
> >>> the variable using REGEX extractor.
> >>>
> >>> Code -
> >>> <script id="baseState">
> >>> clientKey = clientKey || "123844275807432328";
> >>>
> >>> I used teh regex - \clientKey \ || \ (.+\d) to extract the client key
> >>>
> >>> But, this is not working as it is returning null as value of
> >>> expression.
> >>>
> >>> Can anybody please help me ?
> >>> --
> >>> View this message in context:
> >>>
> http://www.nabble.com/Jmeter---regex-expression-for-variable-from-script-tp25406993p25406993.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
> >>>
> >>
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Jmeter---regex-expression-for-variable-from-script-tp25406993p25409406.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: Jmeter - regex expression for variable from script
Posted by ramnik <rk...@jaspersoft.com>.
Finally , i m able to find the right expression :)
Regex - clientKey =clientKey\||"(\d+?)";
worked perfectly for me ..
thanks Alex for ur response
ramnik wrote:
>
> thanks for quick response ..
>
> i will give it a try now ..:)
>
>
> Alexandru Rotaru wrote:
>>
>> you can take a look at http://jakarta.apache.org/oro/demo.html
>> I think it is a good tool to try you reg exps.
>>
>> for your case, I think you need clientKey \|\| "(.+\d)"
>>
>> Alex
>>
>> On Sep 11, 2009, at 10:26 PM, ramnik wrote:
>>
>>>
>>> Hello,
>>>
>>> I m using Jmeter for Performance Testing and facing issue with
>>> extracting
>>> the variable using REGEX extractor.
>>>
>>> Code -
>>> <script id="baseState">
>>> clientKey = clientKey || "123844275807432328";
>>>
>>> I used teh regex - \clientKey \ || \ (.+\d) to extract the client key
>>>
>>> But, this is not working as it is returning null as value of
>>> expression.
>>>
>>> Can anybody please help me ?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Jmeter---regex-expression-for-variable-from-script-tp25406993p25406993.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
>>>
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Jmeter---regex-expression-for-variable-from-script-tp25406993p25409406.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: Jmeter - regex expression for variable from script
Posted by ramnik <rk...@jaspersoft.com>.
thanks for quick response ..
i will give it a try now ..:)
Alexandru Rotaru wrote:
>
> you can take a look at http://jakarta.apache.org/oro/demo.html
> I think it is a good tool to try you reg exps.
>
> for your case, I think you need clientKey \|\| "(.+\d)"
>
> Alex
>
> On Sep 11, 2009, at 10:26 PM, ramnik wrote:
>
>>
>> Hello,
>>
>> I m using Jmeter for Performance Testing and facing issue with
>> extracting
>> the variable using REGEX extractor.
>>
>> Code -
>> <script id="baseState">
>> clientKey = clientKey || "123844275807432328";
>>
>> I used teh regex - \clientKey \ || \ (.+\d) to extract the client key
>>
>> But, this is not working as it is returning null as value of
>> expression.
>>
>> Can anybody please help me ?
>> --
>> View this message in context:
>> http://www.nabble.com/Jmeter---regex-expression-for-variable-from-script-tp25406993p25406993.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
>>
>
>
>
--
View this message in context: http://www.nabble.com/Jmeter---regex-expression-for-variable-from-script-tp25406993p25407273.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: Jmeter - regex expression for variable from script
Posted by Alexandru Rotaru <al...@altom.ro>.
you can take a look at http://jakarta.apache.org/oro/demo.html
I think it is a good tool to try you reg exps.
for your case, I think you need clientKey \|\| "(.+\d)"
Alex
On Sep 11, 2009, at 10:26 PM, ramnik wrote:
>
> Hello,
>
> I m using Jmeter for Performance Testing and facing issue with
> extracting
> the variable using REGEX extractor.
>
> Code -
> <script id="baseState">
> clientKey = clientKey || "123844275807432328";
>
> I used teh regex - \clientKey \ || \ (.+\d) to extract the client key
>
> But, this is not working as it is returning null as value of
> expression.
>
> Can anybody please help me ?
> --
> View this message in context: http://www.nabble.com/Jmeter---regex-expression-for-variable-from-script-tp25406993p25406993.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
>