You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by "Liao, Avian" <al...@enporion.com> on 2004/12/07 19:27:56 UTC

RE: question of Regular Expressions

Hi, Sebb, 

The page looks like this:

https://erfx.uat.enporion.com/instance/processPost?_processid=3FFBB12D-AEB8-84B4-4995-B648B69EC797&_component=Main_Page&_selfLoadingURL=%2Fdcmenus%2FMain_Page%2Fmenugui.jsp" (first Page)

I need to extract the value after _processid=, so I use regular expression extractor
	Reference Name: _processid
 	Regular Expression: _processid = (\w*-\w*-\w*-\w*-\w*)
	Template:$1$
	Match NO. : 0
This works fine, and I got what I want.

My problem is in the following page, when I have more than one set of data that match my regular expression. 

https://erfx.uat.enporion.com/instance/processPost?_processid=3FFBE12D-AEBE-3258-110A-1490B937A6C3&_component=Main_Page&_selfLoadingURL=%2Fdcrfxeventwizard%2FMain_Page%2Feventgui.jsp" (second page)

https://erfx.uat.enporion.com/instance/processPost?_processid=3FFBE12D-AEBE-3258-110A-1490B937A6C3&_component=Main_Page&_selfLoadingURL=%2Fdcrfxeventwizard%2FMain_Page%2Feventgui.jsp" (Third page)

As you can see, there are two identical _processid, but their value are different than the first page. I kind of copy everything over, except changing the reference name. However, it does not work. 

	Reference Name: _processid2
 	Regular Expression: _processid2 = (\w*-\w*-\w*-\w*-\w*)
	Template:$1$
	Match NO. : 0

After trying all different regular expression that come from Jmeter's help (I believe they are all good, but just don't know why it did not work in my case), I end with using my old regular expressions, except reuse my reference name that I use in the first page. 

	Reference Name: _processid
 	Regular Expression: _processid = (\w*-\w*-\w*-\w*-\w*)
	Template:$1$
	Match NO. : 0

And, surprisely, it works. I don't know how to explain, but I am going to settle with it, if there are no better solution. 
Thanks for all the effort.

Avian

-----Original Message-----"
From: sebb [mailto:sebbaz@gmail.com]
Sent: Tuesday, December 07, 2004 2:59 AM
To: JMeter Users List
Subject: Re: question of Regular Expressions


On Mon, 6 Dec 2004 16:47:09 -0500, Liao, Avian <al...@enporion.com> wrote:
> Hi,
> 
> I try to use regular Expression Extractor to catch the following:
> 
> "3FFBE12D-AA29-B37B-4612-8173B7C2CCE7"
> 
> and I use the Regular Expression Extractor:
> Reference Name: AAA
> Regular Expression: AAA = (\w*-\w*-\w*-\w*-\w*)

This looks wrong. Does your data really contain strings like:

"AAA = 3FFBE12D-AA29-B37B-4612-8173B7C2CCE7"

Surely you need

(\w+-\w+-\w+-\w+-\w+)

or perhaps

(\w{8}-\w{4}-\w{4}-\w{4}-\w{8})

The JMeter Wiki has a section on Regular Expressions.

> Template:$1$
> Match No: 0
> Default value: No Result
> 
> I found out, if there is only one set of this data in the page, my extractor is working fine, and I can catch all the value.However, if I have multiple same set of data in one page, the Regular Expressions Extractor return nothing. When I am said "same set of data", I mean there are couple of same "3FFBE12D-AA29-B37B-4612-8173B7C2CCE7" in the one page, and for my test, I do not care which one I catch (since they are identical), and I just need that value to go on. Besides Regular Expressions Extractor,can we use another sampler or function to catch the value.
> 
> I saw the value I need in response data(when I use View Response Tree), and I just cannot catch it.
> 
> Alao, if someone know how to catch the same set of data in deisred location( e.g. the third one), I would love to learn.

This is described in the User Manual:

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Regular_Expression_Extractor

see: Match No.

> 
> Thanks!
> 
> AL
> 
> ---------------------------------------------------------------------
> 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