You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Brian Devaney <bd...@docfinity.com> on 2012/03/02 20:37:40 UTC

Regular Expression Extractor problems

I am trying to use the Regular Expression Extractor to process search
results from a web service call.  I have a regex that correctly
identifies the data I want, but I do not know why it does not get
assigned to the reference name.

The extractor is set to apply to the main sample only. with the body
(unescaped) option selected.  The other settings are: 
regex: docid=&quot;(\w{32})&quot;
Template: $1$
Match No.: 0
Default Value: NOT FOUND

A small section of the data that is returned and that I am trying to get
a ID pulled from is:

  &lt;/columns&gt;&lt;result
docid=&quot;8a8a823435cf9a2c0135d03b08350388&quot;
docTypeId=&quot;8a8a823435cf5cd60135cf6ca97a3b7e&quot;

As part of the regex, I have also tried \w* and \w*?

The idea is to get the unique identifier with the surrounding quotes
stripped off.  I have Mozilla Firefox's Regular Expression Tester and
the regex does find the right ID along with the quotes and docid=.  From
the help, it looks like the parenthesis indicate which part of the
string that matches is to be assigned to the Reference Name variable.  

Thank you for your help.

-- 

Brian Devaney
Software Developer
DocFinity®
(814) 238-0038x274
mailto:bdevaney@DocFinity.com
http://www.docfinity.com/
 


DISCLAIMER: This email may contain proprietary information, some or all
of which may be legally privileged. It is for the intended recipient
only. If an addressing or transmission error has misdirected this email,
please notify the author by replying to this email. If you are not the
intended recipient, you may not use, disclose, distribute, copy, print,
or rely on this email.


Re: Regular Expression Extractor problems

Posted by sebb <se...@gmail.com>.
On 2 March 2012 20:16, Brian Devaney <bd...@docfinity.com> wrote:

> **
> I've changed the Respnse Field to Body and that set the reference name
> variable to:
>
> docid=&quot;8a8a823435cf9a2c0135d03b08350388&quot;
>
> The problem is that while it is a hex string, there are many others in the
> returned data that resemble it.  I need the hex string delimited by "docid="
>

I meant, replace \w+ by [a-f0-9]+


> As a test I had the template set to "$0$" to show the string I was
> matching.  That is now at $1$ and the proper delimited string is returned.
>
> Thank you for your prompt reply.  It seems my basic mistake was using the
> Body (unescaped) option.
>
>
Glad it's sorted.

Re: Regular Expression Extractor problems

Posted by Brian Devaney <bd...@docfinity.com>.
I've changed the Respnse Field to Body and that set the reference name
variable to:

docid=&quot;8a8a823435cf9a2c0135d03b08350388&quot;

The problem is that while it is a hex string, there are many others in
the returned data that resemble it.  I need the hex string delimited by
"docid="

As a test I had the template set to "$0$" to show the string I was
matching.  That is now at $1$ and the proper delimited string is
returned.

Thank you for your prompt reply.  It seems my basic mistake was using
the Body (unescaped) option.

On Fri, 2012-03-02 at 20:05 +0000, sebb wrote:

> On 2 March 2012 19:37, Brian Devaney <bd...@docfinity.com> wrote:
> 
> [Please use plain text]
> 
> 
> > I am trying to use the Regular Expression Extractor to process search results from a web service call.  I have a regex that correctly identifies the data I want, but I do not know why it does not get assigned to the reference name.
> >
> 
> So what does the reference name get set to?
> 
> > The extractor is set to apply to the main sample only. with the body (unescaped) option selected.  The other settings are:
> > regex: docid=&quot;(\w{32})&quot;
> > Template: $1$
> > Match No.: 0
> 
> Do you really want a random match?
> 
> > Default Value: NOT FOUND
> >
> > A small section of the data that is returned and that I am trying to get a ID pulled from is:
> >
> >   &lt;/columns&gt;&lt;result docid=&quot;8a8a823435cf9a2c0135d03b08350388&quot; docTypeId=&quot;8a8a823435cf5cd60135cf6ca97a3b7e&quot;
> >
> > As part of the regex, I have also tried \w* and \w*?
> 
> You could also use
> 
> [a-f0-9]+
> 
> as the value seems to be lowercase hex.
> 
> > The idea is to get the unique identifier with the surrounding quotes stripped off.  I have Mozilla Firefox's Regular Expression Tester and the regex does find the right ID along with the quotes and docid=.
> 
> However, the Firefox plugin may not be using the same RE engine - or
> indeed using exactly the same input data.
> 
> > From the help, it looks like the parenthesis indicate which part of the string that matches is to be assigned to the Reference Name variable.
> 
> Yes.
> 
> > Thank you for your help.
> >
> > --
> >
> > Brian Devaney
> > Software Developer
> > DocFinity®
> > (814) 238-0038x274
> > mailto:bdevaney@DocFinity.com
> > http://www.docfinity.com/
> >
> >
> >
> > DISCLAIMER: This email may contain proprietary information, some or all
> > of which may be legally privileged. It is for the intended recipient
> > only. If an addressing or transmission error has misdirected this email,
> > please notify the author by replying to this email. If you are not the
> > intended recipient, you may not use, disclose, distribute, copy, print,
> > or rely on this email.
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
> 


-- 

Brian Devaney
Software Developer
DocFinity®
(814) 238-0038x274
mailto:bdevaney@DocFinity.com
http://www.docfinity.com/
 


DISCLAIMER: This email may contain proprietary information, some or all
of which may be legally privileged. It is for the intended recipient
only. If an addressing or transmission error has misdirected this email,
please notify the author by replying to this email. If you are not the
intended recipient, you may not use, disclose, distribute, copy, print,
or rely on this email.


Re: Regular Expression Extractor problems

Posted by sebb <se...@gmail.com>.
On 2 March 2012 19:37, Brian Devaney <bd...@docfinity.com> wrote:

[Please use plain text]


> I am trying to use the Regular Expression Extractor to process search results from a web service call.  I have a regex that correctly identifies the data I want, but I do not know why it does not get assigned to the reference name.
>

So what does the reference name get set to?

> The extractor is set to apply to the main sample only. with the body (unescaped) option selected.  The other settings are:
> regex: docid=&quot;(\w{32})&quot;
> Template: $1$
> Match No.: 0

Do you really want a random match?

> Default Value: NOT FOUND
>
> A small section of the data that is returned and that I am trying to get a ID pulled from is:
>
>   &lt;/columns&gt;&lt;result docid=&quot;8a8a823435cf9a2c0135d03b08350388&quot; docTypeId=&quot;8a8a823435cf5cd60135cf6ca97a3b7e&quot;
>
> As part of the regex, I have also tried \w* and \w*?

You could also use

[a-f0-9]+

as the value seems to be lowercase hex.

> The idea is to get the unique identifier with the surrounding quotes stripped off.  I have Mozilla Firefox's Regular Expression Tester and the regex does find the right ID along with the quotes and docid=.

However, the Firefox plugin may not be using the same RE engine - or
indeed using exactly the same input data.

> From the help, it looks like the parenthesis indicate which part of the string that matches is to be assigned to the Reference Name variable.

Yes.

> Thank you for your help.
>
> --
>
> Brian Devaney
> Software Developer
> DocFinity®
> (814) 238-0038x274
> mailto:bdevaney@DocFinity.com
> http://www.docfinity.com/
>
>
>
> DISCLAIMER: This email may contain proprietary information, some or all
> of which may be legally privileged. It is for the intended recipient
> only. If an addressing or transmission error has misdirected this email,
> please notify the author by replying to this email. If you are not the
> intended recipient, you may not use, disclose, distribute, copy, print,
> or rely on this email.
>

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