Return-Path: X-Original-To: apmail-jmeter-user-archive@www.apache.org Delivered-To: apmail-jmeter-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 290DA109BC for ; Wed, 28 Aug 2013 13:24:17 +0000 (UTC) Received: (qmail 71404 invoked by uid 500); 28 Aug 2013 13:24:16 -0000 Delivered-To: apmail-jmeter-user-archive@jmeter.apache.org Received: (qmail 71097 invoked by uid 500); 28 Aug 2013 13:24:11 -0000 Mailing-List: contact user-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "JMeter Users List" Delivered-To: mailing list user@jmeter.apache.org Received: (qmail 71084 invoked by uid 99); 28 Aug 2013 13:24:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Aug 2013 13:24:09 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of praumesh86@gmail.com designates 74.125.82.49 as permitted sender) Received: from [74.125.82.49] (HELO mail-wg0-f49.google.com) (74.125.82.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Aug 2013 13:24:02 +0000 Received: by mail-wg0-f49.google.com with SMTP id a12so3263435wgh.16 for ; Wed, 28 Aug 2013 06:23:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=1C8pRAtoFuet9co8C6k20RpiMNRay8XzrvOo0NKQ6Y8=; b=HtR+PbypG2+WNu36QdBBpiUd26lr/8UXEimEd6HlJMwLlQg4guwIx98SvydwF+WO/Q tOQ+Zk3/dBcn6Na30/IiNFtAFNYSWNVZmz2hyw5jr0JRZr+APP8o+Fi3byfeiVPBujwD uq0mgaUraf3oyXm7jrjkYq5/mi0m7y8Sr2YSk1ECM20zgE2CO0d+VBkmvMICVsm/fMUv aIhGjihglABOMsEktwlXb8dh8hsZTV70WDAv95sNlSX1JMpXzrrQfCMZkTASneLqqZNU gR8iS5XPQZA89kan0/Z2pewb4+xffQYVH3phvrNsbar1wo2zfKsb/hJLOAi4vkyNHNnO xmQw== MIME-Version: 1.0 X-Received: by 10.194.173.163 with SMTP id bl3mr20424028wjc.10.1377696222240; Wed, 28 Aug 2013 06:23:42 -0700 (PDT) Received: by 10.194.133.74 with HTTP; Wed, 28 Aug 2013 06:23:42 -0700 (PDT) In-Reply-To: References: Date: Wed, 28 Aug 2013 06:23:42 -0700 Message-ID: Subject: Re: Regular Expressioin Extractor From: umesh prajapati To: JMeter Users List Content-Type: multipart/alternative; boundary=089e013c6220ef63cd04e501e54f X-Virus-Checked: Checked by ClamAV on apache.org --089e013c6220ef63cd04e501e54f Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Thank you Manish, I get the idea of how to you for each in conjuction with reg ex but I would like to save the each extracted value from the response. For example in your tutorial, you have extracted 1234, 12345. (account numbers) So I would like to save those into a txt file as below 1234 12345 On Tue, Aug 27, 2013 at 11:25 PM, Manish Sapariya wrot= e: > Hi Umesh, > I think ForEach controller is what you need. > > > http://jmeter.apache.org/usermanual/component_reference.html#ForEach_Cont= roller > > I have a screencast to demonstrate how to use ForEach controller with reg= ex > to extract list of values. > > > http://my.kpoint.com/kapsule/gcc-1dadaeee-1572-4c83-81fc-8d401cade743/t/m= ultivalue-regex-jmeter-tutorial > > Hope its useful. Do let me know if you something could have been added to > the screencast. > > Thanks and Regards, > Manish > kPoint wins *Global eLearning > Award > > * in =93Learning Technologies Solution=94! > > > On Wed, Aug 28, 2013 at 6:03 AM, umesh prajapati >wrote: > > > or What is the other way of saving them beside sample_variable feature > > > > > > On Tue, Aug 27, 2013 at 5:29 PM, umesh prajapati > >wrote: > > > > > Thank you for the tips ".*?" > > > > > > So, where can I defind username_n. so I dont have to write username_1= , > > > username_2.............................username_500 (500 times) > > > > > > > > > On Tue, Aug 27, 2013 at 5:16 PM, sebb wrote: > > > > > >> On 28 August 2013 01:03, umesh prajapati > wrote: > > >> > Hi Sebb, > > >> > > > >> > I see what Regular expression was doing. > > >> > > > >> > For example, lets say i have the following response: > > >> > > > >> > > > >> > > > ffffffff521cf326e4b05c028a28007d1aug27131aug2713Unspecified1aug2713password1SHASSOCGfalse > > >> > > > >> > > > ffffffff521cf326e4b05c028a28007e2aug27132aug2713Unspecified2aug2713password1SHASSOCGfalse > > >> > > > >> > > > ffffffff521cf326e4b05c028a28007f3aug27133aug2713Unspecified3aug2713password1SHASSOCGfalse > > >> > > > >> > My Regular expression extractor is as follow: > > >> > Reference Name: username > > >> > Regular Expression: > > >> > (.+?).*(.+?) > > >> > > >> The ".*" in the middle of the RE is greedy; it will match as much as > > >> possible. > > >> Use ".*?" instead. > > >> > > >> > Template: $1$ $2$ > > >> > Match No.=3D 1 > > >> > > > >> > > > >> > The value that is being saved on my txt file that I mentioned is > like > > >> this. > > >> > > > >> > ffffffff521cf326e4b05c028a28007d,3aug2713 > > >> > > > >> > So, it is saving the first userId and the last Username. > > >> > > >> See above; the RE has a greedy middle. > > >> > > >> > When I tried -1, on my txt file it is saving null. > > >> > > > >> > Just to do some more research on it, I changed my regular expressi= on > > as > > >> > below and I also added debug sampler > > >> > Reference Name: username > > >> > Regular Expression: (.+?) > >> > Template: $1$ > > >> > Match No.=3D -1 > > >> > > > >> > When I look at debug Sampler Response data with above configuratio= n > I > > >> see > > >> > it is extracting all three UserId and I changed the jmeter.propert= y > > >> file as > > >> > sample_variables=3Dusername_1,username_2,username_3 > > >> > This let me save all 3 userId in a file i have mentioned. But the > > issue > > >> is > > >> > If i have 500 UserId, do I have to mention all 500 in property fil= e. > > >> > > >> Yes, if you want to save them using the sample_variables feature. > > >> > > >> > I have tried sample_variables=3Dusername_n but the value that got > saved > > >> in a file is null. > > >> > > >> Yes, because the variable username_n is not defined. > > >> > > >> > JMeterVariables: > > >> > JMeterThread.last_sample_ok=3Dtrue > > >> > JMeterThread.pack=3Dorg.apache.jmeter.threads.SamplePackage@1ed2e5= 5e > > >> > START.HMS=3D163623 > > >> > START.MS=3D1377646583923 > > >> > START.YMD=3D20130827 > > >> > TESTSTART.MS=3D1377647571490 > > >> > username_1=3Dffffffff521cf326e4b05c028a28007d > > >> > username_1_g=3D1 > > >> > > > username_1_g0=3Dffffffff521cf326e4b05c028a28007d > > >> > username_1_g1=3Dffffffff521cf326e4b05c028a28007d > > >> > username_2=3Dffffffff521cf326e4b05c028a28007e > > >> > username_2_g=3D1 > > >> > > > username_2_g0=3Dffffffff521cf326e4b05c028a28007e > > >> > username_2_g1=3Dffffffff521cf326e4b05c028a28007e > > >> > username_3=3Dffffffff521cf326e4b05c028a28007f > > >> > username_3_g=3D1 > > >> > > > username_3_g0=3Dffffffff521cf326e4b05c028a28007f > > >> > username_3_g1=3Dffffffff521cf326e4b05c028a28007f > > >> > username_matchNr=3D3 > > >> > > > >> > 2n Question, I am trying to extract not only userId but the > > >> corresponding > > >> > Username of the UserId. So, when I have my regular expression as > > below: > > >> > > > >> > Regular Expression: > > >> > (.+?).*(.+?) > > >> > > > >> > it is extracting the first userId and the last username. What woul= d > be > > >> the > > >> > right Reg Ex expression to extract all of them. > > >> > > >> See above. > > >> > > >> > > > >> > > > >> > > > >> > > > >> > > > >> > On Tue, Aug 27, 2013 at 2:44 PM, umesh prajapati < > > praumesh86@gmail.com > > >> >wrote: > > >> > > > >> >> Ignore my comment about Match No =3D 1 because I only have one ma= in > > >> sample. > > >> >> > > >> >> According to Jmeter documentation: > > >> >> > > >> >> Indicates which match to use. The regular expression may match > > multiple > > >> >> times. > > >> >> > > >> >> - Use a value of zero to indicate JMeter should choose a match > at > > >> >> random. > > >> >> - A positive number N means to select the nth match. > > >> >> - Negative numbers are used in conjunction with the ForEach > > >> controller > > >> >> - see below. > > >> >> > > >> >> i have tried 0 and still extract the last match, I have tried 1 a= nd > > >> still > > >> >> extract the last match, and any number beside 1 and 0 gives null. > > >> >> > > >> >> > > >> >> On Tue, Aug 27, 2013 at 2:14 PM, umesh prajapati < > > praumesh86@gmail.com > > >> >wrote: > > >> >> > > >> >>> If the match number is set to a negative number, then all the > > possible > > >> >>> matches in the sampler data are processed. The variables are set > as > > >> follows: > > >> >>> > > >> >>> > > >> >>> - refName_matchNr - the number of matches found; could be 0 > > >> >>> - refName_n, where n =3D 1,2,3 etc - the strings as generated= by > > the > > >> >>> template > > >> >>> - refName_n_gm, where m=3D0,1,2 - the groups for match n > > >> >>> - refName - always set to the default value > > >> >>> - refName_gn - not set > > >> >>> > > >> >>> I am not understanding this.. an example on how to extract all > > matches > > >> >>> would be great > > >> >>> > > >> >>> > > >> >>> On Tue, Aug 27, 2013 at 1:37 PM, umesh prajapati < > > >> praumesh86@gmail.com>wrote: > > >> >>> > > >> >>>> So, in my case Match No. =3D 1 because I only have one main sam= ple. > > >> >>>> > > >> >>>> But this is not extracting all 500 userId and corresponding > > username > > >> but > > >> >>>> instead just extracting one userId and corresponding username > > >> >>>> > > >> >>>> > > >> >>>> On Tue, Aug 27, 2013 at 1:11 PM, sebb wrote: > > >> >>>> > > >> >>>>> On 27 August 2013 19:58, umesh prajapati > > >> wrote: > > >> >>>>> > My response will be as below: > > >> >>>>> > > > >> >>>>> > > > >> >>>>> > > > >> >>>>> > > >> > > > PSN_1Complete > > >> >>>>> > > >> >>>>> > > >> > > > RowId=3D"1">ffffffff521cf326e4b05c028a28007d1aug27131aug2713Unspecified1aug2713password1SHASSO= CGfalse > >> >>>>> > > > >> >>>>> > > >> > > > ffffffff521cf326e4b05c028a28007e2aug27132aug2713Unspecified2aug2713password1SHASSOCGfalse > >> >>>>> > > > >> >>>>> > > >> > > > ffffffff521cf326e4b05c028a28007f3aug27133aug2713Unspecified3aug2713password1SHASSOCGfalse > > >> >>>>> > ...... > > >> >>>>> > ......... > > >> >>>>> > .... > > >> >>>>> > ........... > > >> >>>>> > > > >> >>>>> > > > >> >>>>> > So, I would like to extract all 500 userId and corresponding > > >> Username > > >> >>>>> to it > > >> >>>>> > and save it on a file like this: > > >> >>>>> > ffffffff521cf326e4b05c028a28007d,1aug2713 > > >> >>>>> > ffffffff521cf326e4b05c028a28007e,2aug2713 > > >> >>>>> > ffffffff521cf326e4b05c028a28007f,3aug2713 > > >> >>>>> > ............. > > >> >>>>> > .......... > > >> >>>>> > ..... > > >> >>>>> > > > >> >>>>> > > > >> >>>>> > In my regular expression extractor this is what I have so fa= r: > > >> >>>>> > > > >> >>>>> > Regular Expression: > > >> >>>>> > > > (.+?).*(.+?) > > >> >>>>> > Template:$1$ $2$ > > >> >>>>> > Match No.(0 for Random): (what should i put here to extrat a= ll > > >> >>>>> matching) > > >> >>>>> > > >> >>>>> > > >> >>>>> > > >> > > > http://jmeter.apache.org/usermanual/component_reference.html#Regular_Expr= ession_Extractor > > >> >>>>> > > >> >>>>> See the description of Match No. > > >> >>>>> > > >> >>>>> > Default Value: > > >> >>>>> > > >> >>>>> > > >> --------------------------------------------------------------------= - > > >> >>>>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org > > >> >>>>> For additional commands, e-mail: user-help@jmeter.apache.org > > >> >>>>> > > >> >>>>> > > >> >>>> > > >> >>> > > >> >> > > >> > > >> --------------------------------------------------------------------= - > > >> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org > > >> For additional commands, e-mail: user-help@jmeter.apache.org > > >> > > >> > > > > > > --089e013c6220ef63cd04e501e54f--