You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Kyle Schmitt <ky...@gmail.com> on 2006/11/29 01:03:32 UTC

regular expression extractor problems

Hey, I'm trying to use a regular expression extractor, and it's just
not working. Hopefully someone will be able to tell me what I'm doing
wrong.

The regex extractor is a child of an http sampler, and the variable
it's supposed to set is used a few samplers later, but when it
happens, I actually see ${product} in my log instead of what the regex
matches, or instead of the default value even!

The fields of the regex are setup like this:

Reference Name:
product
Regular Expression:
SelectRow('${major}|(.+?*)
Template:
$1$
Match No.
1
Default Value
EEEEK!


Help?  Help?

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


Re: regular expression extractor problems

Posted by sebb <se...@gmail.com>.
This could be added to the Wiki ...

On 30/11/06, Gantcho.Kojuharov@mail.ing.nl
<Ga...@mail.ing.nl> wrote:
> Oops! Posted on the worng thread. Sorry about that. Here I go again:
>
> For testing regex I'd really recommend http://rexv.org/ - it is a great
> online regex evaluation engine with support for different regex systems
> and modifiers.
>
> Cheers!
> Gantcho
>
> -----Original Message-----
> From: Kyle Schmitt [mailto:kyleaschmitt@gmail.com]
> Sent: Wednesday, November 29, 2006 5:16 PM
> To: JMeter Users List
> Subject: Re: regular expression extractor problems
>
>
> Ahh, I found my problem using the
> http://jakarta.apache.org/oro/demo.html page's applet to test my regex
> (oro is a bit different than other regex engines I think..) This maybe a
> touch long, but I hope this will help other folks who've struggled with
> the regex extractor.
>
> My original  was
> SelectRow('${major}|(.+?*)
> It matched nothing
>
> The first fix was
> SelectRow\('${major}|(.+?)
> This was showing a match on each and every part of the string to match
> (one for the first chunk before the (.+?) group, and then one for each
> character in the group)
>
> and what works is
> SelectRow\('${major}\|(.+)'\)
>
> Without the last ' it was matching everything in the (.+?) group, but
> including the final tick, and without escaping the |, it was including
> the | in the result also.
>
>
> Thanks all!
> --Kyle
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> -----------------------------------------------------------------
> ATTENTION:
> The information in this electronic mail message is private and
> confidential, and only intended for the addressee. Should you
> receive this message by mistake, you are hereby notified that
> any disclosure, reproduction, distribution or use of this
> message is strictly prohibited. Please inform the sender by
> reply transmission and delete the message without copying or
> opening it.
>
> Messages and attachments are scanned for all viruses known.
> If this message contains password-protected attachments, the
> files have NOT been scanned for viruses by the ING mail domain.
> Always scan attachments before opening them.
> -----------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> 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: regular expression extractor problems

Posted by Ga...@mail.ing.nl.
Oops! Posted on the worng thread. Sorry about that. Here I go again:

For testing regex I'd really recommend http://rexv.org/ - it is a great
online regex evaluation engine with support for different regex systems
and modifiers. 

Cheers! 
Gantcho

-----Original Message-----
From: Kyle Schmitt [mailto:kyleaschmitt@gmail.com] 
Sent: Wednesday, November 29, 2006 5:16 PM
To: JMeter Users List
Subject: Re: regular expression extractor problems


Ahh, I found my problem using the
http://jakarta.apache.org/oro/demo.html page's applet to test my regex
(oro is a bit different than other regex engines I think..) This maybe a
touch long, but I hope this will help other folks who've struggled with
the regex extractor.

My original  was
SelectRow('${major}|(.+?*)
It matched nothing

The first fix was
SelectRow\('${major}|(.+?)
This was showing a match on each and every part of the string to match
(one for the first chunk before the (.+?) group, and then one for each
character in the group)

and what works is
SelectRow\('${major}\|(.+)'\)

Without the last ' it was matching everything in the (.+?) group, but
including the final tick, and without escaping the |, it was including
the | in the result also.


Thanks all!
--Kyle

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
-----------------------------------------------------------------
ATTENTION:
The information in this electronic mail message is private and
confidential, and only intended for the addressee. Should you
receive this message by mistake, you are hereby notified that
any disclosure, reproduction, distribution or use of this
message is strictly prohibited. Please inform the sender by
reply transmission and delete the message without copying or
opening it.

Messages and attachments are scanned for all viruses known.
If this message contains password-protected attachments, the
files have NOT been scanned for viruses by the ING mail domain.
Always scan attachments before opening them.
-----------------------------------------------------------------


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


Re: regular expression extractor problems

Posted by Kyle Schmitt <ky...@gmail.com>.
Ahh, I found my problem using the
http://jakarta.apache.org/oro/demo.html page's applet to test my regex
(oro is a bit different than other regex engines I think..)
This maybe a touch long, but I hope this will help other folks who've
struggled with the regex extractor.

My original  was
SelectRow('${major}|(.+?*)
It matched nothing

The first fix was
SelectRow\('${major}|(.+?)
This was showing a match on each and every part of the string to match
(one for the first chunk before the (.+?) group, and then one for each
character in the group)

and what works is
SelectRow\('${major}\|(.+)'\)

Without the last ' it was matching everything in the (.+?) group, but
including the final tick, and without escaping the |, it was including
the | in the result also.


Thanks all!
--Kyle

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


Re: regular expression extractor problems

Posted by sebb <se...@gmail.com>.
I've not tried using variables in REs, but if they do work, then the
replacement will be done before the string is used as an RE, so no
escaping is necessary.

Try testing with a fixed string first, and check that the RE works. If
it stops working when the fixed string is replaced with a variable
reference, then either the syntax is wrong, or variables are not being
replaced.

The Java Sampler is useful for testing REs.

S.
On 29/11/06, Kyle Schmitt <ky...@gmail.com> wrote:
> Thanks!
> I'ts still not 100%, but closer.  Now instead of a having ${product}
> show up in the log, at least it's blank..
>
> If I'm referencing a ${variable} in a regex I don't need to escape it right?
>
>
> On 11/28/06, Daniel L. Gregoire <dl...@gmail.com> wrote:
> >
> > > Hey, I'm trying to use a regular expression extractor, and it's just
> > > not working. Hopefully someone will be able to tell me what I'm doing
> > > wrong.
> > >
> > > The regex extractor is a child of an http sampler, and the variable
> > > it's supposed to set is used a few samplers later, but when it
> > > happens, I actually see ${product} in my log instead of what the regex
> > > matches, or instead of the default value even!
> > >
> > > The fields of the regex are setup like this:
> > >
> > > Reference Name:
> > > product
> > > Regular Expression:
> > > SelectRow('${major}|(.+?*)
> > > Template:
> > > $1$
> > > Match No.
> > > 1
> > > Default Value
> > > EEEEK!
> > >
> > >
> > > Help?  Help?
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> > Make sure you've escaped all the metacharacters you need to in the
> > string, probably the first "(", the "$", and the first "{" if you are
> > trying to simply reference the plain code.
> >
> > I've found that a failed regex extractor will return "${your_variable}".
> > It's probably failing because the first "(" is not escaped.
> >
> >
> > ---------------------------------------------------------------------
> > 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: regular expression extractor problems

Posted by Kyle Schmitt <ky...@gmail.com>.
Thanks!
I'ts still not 100%, but closer.  Now instead of a having ${product}
show up in the log, at least it's blank..

If I'm referencing a ${variable} in a regex I don't need to escape it right?


On 11/28/06, Daniel L. Gregoire <dl...@gmail.com> wrote:
>
> > Hey, I'm trying to use a regular expression extractor, and it's just
> > not working. Hopefully someone will be able to tell me what I'm doing
> > wrong.
> >
> > The regex extractor is a child of an http sampler, and the variable
> > it's supposed to set is used a few samplers later, but when it
> > happens, I actually see ${product} in my log instead of what the regex
> > matches, or instead of the default value even!
> >
> > The fields of the regex are setup like this:
> >
> > Reference Name:
> > product
> > Regular Expression:
> > SelectRow('${major}|(.+?*)
> > Template:
> > $1$
> > Match No.
> > 1
> > Default Value
> > EEEEK!
> >
> >
> > Help?  Help?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
>
>
> Make sure you've escaped all the metacharacters you need to in the
> string, probably the first "(", the "$", and the first "{" if you are
> trying to simply reference the plain code.
>
> I've found that a failed regex extractor will return "${your_variable}".
> It's probably failing because the first "(" is not escaped.
>
>
> ---------------------------------------------------------------------
> 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: regular expression extractor problems

Posted by "Daniel L. Gregoire" <dl...@gmail.com>.
> Hey, I'm trying to use a regular expression extractor, and it's just
> not working. Hopefully someone will be able to tell me what I'm doing
> wrong.
> 
> The regex extractor is a child of an http sampler, and the variable
> it's supposed to set is used a few samplers later, but when it
> happens, I actually see ${product} in my log instead of what the regex
> matches, or instead of the default value even!
> 
> The fields of the regex are setup like this:
> 
> Reference Name:
> product
> Regular Expression:
> SelectRow('${major}|(.+?*)
> Template:
> $1$
> Match No.
> 1
> Default Value
> EEEEK!
> 
> 
> Help?  Help?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
> 


Make sure you've escaped all the metacharacters you need to in the
string, probably the first "(", the "$", and the first "{" if you are
trying to simply reference the plain code.

I've found that a failed regex extractor will return "${your_variable}".
It's probably failing because the first "(" is not escaped.


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