You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Rob Schroder <ro...@manilla.com> on 2010/12/01 02:51:13 UTC

Problem with Regular Expression Extractor

Hi,

I'm trying to use the Regular Expression Extractor.  I've verified that I can use it to parse out simple text.  But, when I try to parse the following string:

6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg=

Form this HTML snippet:

<meta name="csrf-param" content="authenticity_token"/>
<meta name="csrf-token" content="6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg="/>

The Regular Expression Extractor doesn't find the string.

I've verified that the following regular expression works using a regular expression editor:

(?<="csrf-token" content=").*(?=")

Any ideas on why this isn't working, or how to debug this?

Thanks...Rob

Re: Problem with Regular Expression Extractor

Posted by sebb <se...@gmail.com>.
On 1 December 2010 18:38, Rob Schroder <ro...@manilla.com> wrote:
> HI Steve,
>
> I was originally using: (?<=("csrf-token" content=")).*(?=("))
>
> But, ORO does not support look behinds.
>
> I just tried using Milamber's suggestion:  csrf-token" content="([^"]+)
> This returns: csrf-token" content="6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg=
>
> But, as Sebb pointed out, I had not configured the template properly to return the correct pair.  It works now.
>
> Thank you all for your support as I cut my teeth on regular expressions, and jmeter!
>

Thanks for letting us know that your issue has been solved - always
good to know that!


And if you have any suggestions for improving the RE and JMeter doc,
please let us know - best via Bugzilla if it may take a while to fix.

BTW, I already added a section about the Perl extended REs supported
(or not) by ORO to the RE section of the manual; this will be in the
next release, whenever that is.


> Regards,
> Rob
>
>
> On 12/1/10 9:00 AM, "Steve Eckhart" <St...@wausaufs.com> wrote:
>
> Rob,
>
> Check for the placement of parentheses () in the regex. JMeter grabs the text between the parentheses.
>
> Can you send the exact regex you're using now?
>
> Steve Eckhart
> Lead Quality Assurance Analyst
>
> WAUSAU Financial Systems
> 14010 FNB PKWY STE500
> Omaha, NE 68154-5206
> Main: (402) 431-8810
> Direct line: (402) 715-9382
> Email: steve.eckhart@wausaufs.com
>
> Enterprise Payment Solutions.
> CONFIDENTIALITY NOTICE:  This electronic transmission (including files attached hereto) is intended only for the use of the individual or entity named above.  If the reader of this message is not the intended recipient, you are hereby notified that any disclosure, dissemination, copying, distribution or taking of any action in reliance on the contents of this confidential information is strictly prohibited.  If you have received this communication in error, please destroy it and immediately notify us by return email.  Thank you.
>
>
>
> -----Original Message-----
> From: Rob Schroder [mailto:rob@manilla.com]
> Sent: Wednesday, December 01, 2010 10:38 AM
> To: JMeter Users List
> Subject: Re: Problem with Regular Expression Extractor
>
> Thanks for the tip about the combo box!
>
> The problem with the regular expression that you suggest, csrf-token" content="([^"]+), is that it leaves <csrf-token" content="> in the result.
>
> What I need is to be able to just grab the dynamic string, in this case: 6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg=
>
> From this line:
> <meta name="csrf-token" content="6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg="/>
>
> Like I said, the string is a dynamic value.  For example:
> <meta name="csrf-token" content="sXpW2DRUpZHgE3lIWjkTmlQYGrY7Gyi6pOhW14pfWvw="/>
>
>
> I guess since look behind isn't supported, I'll have to use a subexpression.  It's just not immediately clear how to do it :')
>
> Regards,
> Rob
>
>
> On 11/30/10 11:13 PM, "Milamber" <mi...@apache.org> wrote:
>
> Hello,
>
> Regexp can be testing directly on JMeter in View Results Tree with
> Regexp tester view (combo list). JMeter use ORO as regexp engine.
>
> Try this :
>
> csrf-token" content="([^"]+)
>
> Milamber
>
> Le 01/12/2010 01:51, Rob Schroder a ecrit :
>> Hi,
>>
>> I'm trying to use the Regular Expression Extractor.  I've verified that I can use it to parse out simple text.  But, when I try to parse the following string:
>>
>> 6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg=
>>
>> Form this HTML snippet:
>>
>> <meta name="csrf-param" content="authenticity_token"/>
>> <meta name="csrf-token" content="6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg="/>
>>
>> The Regular Expression Extractor doesn't find the string.
>>
>> I've verified that the following regular expression works using a regular expression editor:
>>
>> (?<="csrf-token" content=").*(?=")
>>
>> Any ideas on why this isn't working, or how to debug this?
>>
>> Thanks...Rob
>>
>>
>
>
> ---------------------------------------------------------------------
> 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: Problem with Regular Expression Extractor

Posted by Rob Schroder <ro...@manilla.com>.
HI Steve,

I was originally using: (?<=("csrf-token" content=")).*(?=("))

But, ORO does not support look behinds.

I just tried using Milamber's suggestion:  csrf-token" content="([^"]+)
This returns: csrf-token" content="6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg=

But, as Sebb pointed out, I had not configured the template properly to return the correct pair.  It works now.

Thank you all for your support as I cut my teeth on regular expressions, and jmeter!

Regards,
Rob


On 12/1/10 9:00 AM, "Steve Eckhart" <St...@wausaufs.com> wrote:

Rob,

Check for the placement of parentheses () in the regex. JMeter grabs the text between the parentheses.

Can you send the exact regex you're using now?

Steve Eckhart
Lead Quality Assurance Analyst

WAUSAU Financial Systems
14010 FNB PKWY STE500
Omaha, NE 68154-5206
Main: (402) 431-8810
Direct line: (402) 715-9382
Email: steve.eckhart@wausaufs.com

Enterprise Payment Solutions.
CONFIDENTIALITY NOTICE:  This electronic transmission (including files attached hereto) is intended only for the use of the individual or entity named above.  If the reader of this message is not the intended recipient, you are hereby notified that any disclosure, dissemination, copying, distribution or taking of any action in reliance on the contents of this confidential information is strictly prohibited.  If you have received this communication in error, please destroy it and immediately notify us by return email.  Thank you.



-----Original Message-----
From: Rob Schroder [mailto:rob@manilla.com]
Sent: Wednesday, December 01, 2010 10:38 AM
To: JMeter Users List
Subject: Re: Problem with Regular Expression Extractor

Thanks for the tip about the combo box!

The problem with the regular expression that you suggest, csrf-token" content="([^"]+), is that it leaves <csrf-token" content="> in the result.

What I need is to be able to just grab the dynamic string, in this case: 6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg=

>From this line:
<meta name="csrf-token" content="6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg="/>

Like I said, the string is a dynamic value.  For example:
<meta name="csrf-token" content="sXpW2DRUpZHgE3lIWjkTmlQYGrY7Gyi6pOhW14pfWvw="/>


I guess since look behind isn't supported, I'll have to use a subexpression.  It's just not immediately clear how to do it :')

Regards,
Rob


On 11/30/10 11:13 PM, "Milamber" <mi...@apache.org> wrote:

Hello,

Regexp can be testing directly on JMeter in View Results Tree with
Regexp tester view (combo list). JMeter use ORO as regexp engine.

Try this :

csrf-token" content="([^"]+)

Milamber

Le 01/12/2010 01:51, Rob Schroder a ecrit :
> Hi,
>
> I'm trying to use the Regular Expression Extractor.  I've verified that I can use it to parse out simple text.  But, when I try to parse the following string:
>
> 6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg=
>
> Form this HTML snippet:
>
> <meta name="csrf-param" content="authenticity_token"/>
> <meta name="csrf-token" content="6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg="/>
>
> The Regular Expression Extractor doesn't find the string.
>
> I've verified that the following regular expression works using a regular expression editor:
>
> (?<="csrf-token" content=").*(?=")
>
> Any ideas on why this isn't working, or how to debug this?
>
> Thanks...Rob
>
>


---------------------------------------------------------------------
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: Problem with Regular Expression Extractor

Posted by Steve Eckhart <St...@wausaufs.com>.
Rob,

Check for the placement of parentheses () in the regex. JMeter grabs the text between the parentheses.

Can you send the exact regex you're using now?

Steve Eckhart
Lead Quality Assurance Analyst

WAUSAU Financial Systems
14010 FNB PKWY STE500
Omaha, NE 68154-5206
Main: (402) 431-8810 
Direct line: (402) 715-9382
Email: steve.eckhart@wausaufs.com
 
Enterprise Payment Solutions.
CONFIDENTIALITY NOTICE:  This electronic transmission (including files attached hereto) is intended only for the use of the individual or entity named above.  If the reader of this message is not the intended recipient, you are hereby notified that any disclosure, dissemination, copying, distribution or taking of any action in reliance on the contents of this confidential information is strictly prohibited.  If you have received this communication in error, please destroy it and immediately notify us by return email.  Thank you.



-----Original Message-----
From: Rob Schroder [mailto:rob@manilla.com] 
Sent: Wednesday, December 01, 2010 10:38 AM
To: JMeter Users List
Subject: Re: Problem with Regular Expression Extractor

Thanks for the tip about the combo box!

The problem with the regular expression that you suggest, csrf-token" content="([^"]+), is that it leaves <csrf-token" content="> in the result.

What I need is to be able to just grab the dynamic string, in this case: 6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg=

>From this line:
<meta name="csrf-token" content="6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg="/>

Like I said, the string is a dynamic value.  For example:
<meta name="csrf-token" content="sXpW2DRUpZHgE3lIWjkTmlQYGrY7Gyi6pOhW14pfWvw="/>


I guess since look behind isn't supported, I'll have to use a subexpression.  It's just not immediately clear how to do it :')

Regards,
Rob


On 11/30/10 11:13 PM, "Milamber" <mi...@apache.org> wrote:

Hello,

Regexp can be testing directly on JMeter in View Results Tree with
Regexp tester view (combo list). JMeter use ORO as regexp engine.

Try this :

csrf-token" content="([^"]+)

Milamber

Le 01/12/2010 01:51, Rob Schroder a ecrit :
> Hi,
>
> I'm trying to use the Regular Expression Extractor.  I've verified that I can use it to parse out simple text.  But, when I try to parse the following string:
>
> 6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg=
>
> Form this HTML snippet:
>
> <meta name="csrf-param" content="authenticity_token"/>
> <meta name="csrf-token" content="6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg="/>
>
> The Regular Expression Extractor doesn't find the string.
>
> I've verified that the following regular expression works using a regular expression editor:
>
> (?<="csrf-token" content=").*(?=")
>
> Any ideas on why this isn't working, or how to debug this?
>
> Thanks...Rob
>
>


---------------------------------------------------------------------
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: Problem with Regular Expression Extractor

Posted by sebb <se...@gmail.com>.
On 1 December 2010 16:37, Rob Schroder <ro...@manilla.com> wrote:
> Thanks for the tip about the combo box!
>
> The problem with the regular expression that you suggest, csrf-token" content="([^"]+), is that it leaves <csrf-token" content="> in the result.

That depends on what you put in the Template.

If you use $1$, it will pick the contents of the first () pair.

> What I need is to be able to just grab the dynamic string, in this case: 6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg=

See above.

> From this line:
> <meta name="csrf-token" content="6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg="/>
>
> Like I said, the string is a dynamic value.  For example:
> <meta name="csrf-token" content="sXpW2DRUpZHgE3lIWjkTmlQYGrY7Gyi6pOhW14pfWvw="/>
>
>
> I guess since look behind isn't supported, I'll have to use a subexpression.  It's just not immediately clear how to do it :')

No, see above.

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


Re: Problem with Regular Expression Extractor

Posted by Rob Schroder <ro...@manilla.com>.
Thanks for the tip about the combo box!

The problem with the regular expression that you suggest, csrf-token" content="([^"]+), is that it leaves <csrf-token" content="> in the result.

What I need is to be able to just grab the dynamic string, in this case: 6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg=

>From this line:
<meta name="csrf-token" content="6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg="/>

Like I said, the string is a dynamic value.  For example:
<meta name="csrf-token" content="sXpW2DRUpZHgE3lIWjkTmlQYGrY7Gyi6pOhW14pfWvw="/>


I guess since look behind isn't supported, I'll have to use a subexpression.  It's just not immediately clear how to do it :')

Regards,
Rob


On 11/30/10 11:13 PM, "Milamber" <mi...@apache.org> wrote:

Hello,

Regexp can be testing directly on JMeter in View Results Tree with
Regexp tester view (combo list). JMeter use ORO as regexp engine.

Try this :

csrf-token" content="([^"]+)

Milamber

Le 01/12/2010 01:51, Rob Schroder a ecrit :
> Hi,
>
> I'm trying to use the Regular Expression Extractor.  I've verified that I can use it to parse out simple text.  But, when I try to parse the following string:
>
> 6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg=
>
> Form this HTML snippet:
>
> <meta name="csrf-param" content="authenticity_token"/>
> <meta name="csrf-token" content="6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg="/>
>
> The Regular Expression Extractor doesn't find the string.
>
> I've verified that the following regular expression works using a regular expression editor:
>
> (?<="csrf-token" content=").*(?=")
>
> Any ideas on why this isn't working, or how to debug this?
>
> Thanks...Rob
>
>


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



Re: Problem with Regular Expression Extractor

Posted by Milamber <mi...@apache.org>.
Hello,

Regexp can be testing directly on JMeter in View Results Tree with
Regexp tester view (combo list). JMeter use ORO as regexp engine.

Try this :

csrf-token" content="([^"]+)

Milamber

Le 01/12/2010 01:51, Rob Schroder a ecrit :
> Hi,
>
> I'm trying to use the Regular Expression Extractor.  I've verified that I can use it to parse out simple text.  But, when I try to parse the following string:
>
> 6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg=
>
> Form this HTML snippet:
>
> <meta name="csrf-param" content="authenticity_token"/>
> <meta name="csrf-token" content="6yuQXuFV5rx2tE5/QL0V9jclw0HnWK+4madV9uAwOsg="/>
>
> The Regular Expression Extractor doesn't find the string.
>
> I've verified that the following regular expression works using a regular expression editor:
>
> (?<="csrf-token" content=").*(?=")
>
> Any ideas on why this isn't working, or how to debug this?
>
> Thanks...Rob
>
>   


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


Re: Problem with Regular Expression Extractor

Posted by sebb <se...@gmail.com>.
On 1 December 2010 07:10, SanderW <sa...@performancearchitecten.nl> wrote:
>
> Double quotes are special characters. They need to be escaped.

Double-quotes are not special in ORO:

http://jakarta.apache.org/jmeter/usermanual/regular_expressions.html#meta_chars

>
> (?<=\"csrf-token\" content=\").*(?=\")

However, according to the end of the following page:

http://jakarta.apache.org/oro/api/org/apache/oro/text/regex/package-summary.html

(?<= - i.e. lookbehind is not supported.

> --
> View this message in context: http://jmeter.512774.n5.nabble.com/Problem-with-Regular-Expression-Extractor-tp3287090p3287284.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: Problem with Regular Expression Extractor

Posted by SanderW <sa...@performancearchitecten.nl>.

Felix Frank-2 wrote:
> 
> This notion keeps coming up on the list. I'm wondering what Regex engine
> treats quotes specially. I'm sure that neither POSIX nor Perl do,
> neither ORO. What others are out there to be wary of?
> 
> Thanks,
> Felix
> 
I have absolutely no idea how I came up with this? In my scripts I'm
automatically escaping the double quotes.....for nothing 

I apologise for the wrong advice
-- 
View this message in context: http://jmeter.512774.n5.nabble.com/Problem-with-Regular-Expression-Extractor-tp3287090p3294056.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: Problem with Regular Expression Extractor

Posted by Felix Frank <ff...@mpexnet.de>.
On 12/01/2010 08:10 AM, SanderW wrote:
> 
> Double quotes are special characters. They need to be escaped.

This notion keeps coming up on the list. I'm wondering what Regex engine
treats quotes specially. I'm sure that neither POSIX nor Perl do,
neither ORO. What others are out there to be wary of?

Thanks,
Felix

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


Re: Problem with Regular Expression Extractor

Posted by SanderW <sa...@performancearchitecten.nl>.
Double quotes are special characters. They need to be escaped.

(?<=\"csrf-token\" content=\").*(?=\") 
-- 
View this message in context: http://jmeter.512774.n5.nabble.com/Problem-with-Regular-Expression-Extractor-tp3287090p3287284.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