Also I havent tested the regex's please verify them .
regards
deepak
On Wed, Dec 1, 2010 at 8:32 PM, Deepak Shetty <[email protected]> wrote:
> Any reason why you dont like the XPATH extractor? (My experience is that
> XPATH expressions are much easier to write and understand and fit most of
> the cases)
> In any case plan b would be
> a. Write a regex post processor to extract the contents of the <select> you
> want . Something like
> (?s)<select\s*name="VB_idCprel"\s*>(.*?)</select> , template=$1$,
> referenceName=var1,MatchNo=1
> verify that you are getting everything in between in the var1 variable
> using a debug sampler
>
> b. Use the regexFunction to run a second regex on var1 to get the option
> value. Something like
> ${__regexFunction(<option.*?value="([^"]*)",$1$,RAND,,NOTFOUND,var2,var1)}
> The documentation for this function is available
> http://jakarta.apache.org/jmeter/usermanual/functions.html#__regexFunctionbut
> its basically a function version of the above post processor.
>
> You can also do the above two steps in one if you know a bit of Java - Just
> use the Java Regex classes and a BeanShell post processor.
>
> As before the XPATH is simpler and elegant.
> regards
> deepak
>
>
>
> On Wed, Dec 1, 2010 at 11:09 AM, Michele Mase' <[email protected]>wrote:
>
>> Nice idea the plan b!
>> How could I extract the value using a second regex?
>> Could you post an useful example?
>>
>> Regards
>> Michele
>>
>> On Tue, Nov 30, 2010 at 4:49 PM, Deepak Shetty <[email protected]> wrote:
>> > a)should be easier to just use an XPATH extractor
>> > //sele...@name="VB_idCprel"]/option/@value
>> > You would however need to generate a random number to select a value
>> from
>> > this
>> >
>> > b. You can also use a regex to extract out the select you are interested
>> in
>> > and another regex to extract out the option values
>> >
>> > regards
>> > deepak
>> >
>> > On Tue, Nov 30, 2010 at 6:59 AM, Michele Mase' <[email protected]
>> >wrote:
>> >
>> >> Ok it works for all the option value; the problem is that there are
>> >> other option values later in the html page that I don't want to
>> >> capture.
>> >> What I need to capture are all the numbers (in my particular case
>> >> between 1 and 20, but the html page may vary, so the numbers could be
>> >> 10, 14 and so on), BUT only in the firs part of the page,
>> >>
>> >> What You have suggested show me all occurences of option value
>> >>
>> >> name="VB_idCprel"><option selected value="0"></option><option
>> >> value="1">C. LUPPA 5</option><option value="2">C.LONGI M.RE
>> >> 1</option><option value="3">CUMPNOL/VILAN 2</option><option
>> >> value="4">CUMPINOGUPA 3</option><option value="5">DELO
>> >> 1</option><option value="6">DELO VABBHIO 1</option><option
>> >> value="7">FAELXO 2</option><option value="8">GHSSA' 1</option>option
>> >> value="9">GWNA DELE 4</option><option value="10">GYNA MARUIT
>> >> 2</option><option value="11">ZWRTAFFAGO 1</option><option
>> >> value="12">ZWRTAFFAGO 2</option><option value="13">CITHNO
>> >> 1</option><option value="14">CITHNO 2</option><option value="15">QOSLE
>> >> 1</option><option value="16">TIAZILA 1</option><option
>> >> value="17">WPFNEA 1</option><option value="18">WPFNEA
>> >> 2</option><option value="19">ATRT' 1</option><option
>> >> value="20">DICOWOJO 1</option></select></td><td
>> >> width="12"><script><label
>> >> for="zon">Zona/distretto</label></span></td><td
>> >> width="12"><script>t('12','0')</script></td><td valign="top" nowrap
>> >> width="63%"><select id="zon" class="x4" name="VB_zona"><option
>> >> selected value="-1"></option></select></td></tr><tr><td
>> >> width="20px"><script>t(20,1)</script></td><td
>> >> colspan="2"></td><td></td></tr><tr><td
>> >> width="20px"><script>t(20,1)</script></td><td align="right" nowrap
>> >> width="37%"><span class="x8"><label for="med">Mxdic di
>> >> bysw</label></span></td><td
>> >> width="12"><script>t('12','0')</script></td><td valign="top" nowrap
>> >> width="63%"><select id="med" class="x4" name="VB_mxdico"><option
>> >> selected value="-1"></option><option value="0">AXXIETTO FWWPO 1320
>> >> 11/01/2036</option><option value="1">ACCRTYJW CFJJESHTA 5452
>> >> 21/01/2009</option><option value="2">GKSTRG WRTMX 13
>> >> 01/01/2002</option><option value="3">KLEWSAIO QAKYCSP 5672
>> >> 01/01/2003</option><option value="4">AHTFDEMU EHUIBSAW 2545
>> >> 01/01/1897</option><option value="5">GHYJ WSEHUMO 1123
>> >> 01/10/2003</option><option value="6">JNHDRAS RMUYI 1224
>> >> 05/01/2009</option><option value="7">DFUJRT QASCFRGI 7215
>> >> 01/04/2004</option><option value="8">HNT ERTS ERFTIOMF 3193
>> >> 07/01/2003</option>
>> >>
>> >> I need only those beteween the interval
>> >> name="VB_idCprel"><option selected value="0">
>> >> and
>> >> </select></td>
>> >> gruped each other in this way <option
>> >> value=\"([0-9]{1,2})\">([A-Z0-5\. \'\/]{6,15})</option>
>> >>
>> >> This wored for me in a better way
>> >> <option value=\"([0-9]{1,2})\">([A-Z0-5\. \'\/]{6,15})</option>
>> >>
>> >> But the problem remains if there is another value that agrees with the
>> >> regex
>> >> EG: just add <option value="8">HNT ERTS ERFTIOMF 3193
>> >> 07/01/2003</option> at the end of the file
>> >>
>> >> On Tue, Nov 30, 2010 at 12:29 AM, Milamber <[email protected]>
>> wrote:
>> >> > Hello,
>> >> >
>> >> > Try this regexp :
>> >> > <option value="([^"]+)">([^<]+)
>> >> >
>> >> > $1$ ==> number (1 to 20)
>> >> > $2$ ==> value (if need)
>> >> >
>> >> > Milamber
>> >> >
>> >> > Le 29/11/2010 23:00, Michele Mase' a ecrit :
>> >> >> I use a regular expression extractor to capture all the values
>> between
>> >> >> the "" in the "option value" field (all of them are numbers, in this
>> >> >> case between 1 and 20)
>> >> >>
>> >> >>
>> >> >> Text to manipulate:
>> >> >> name="VB_idCprel"><option selected value="0"></option><option
>> >> >> value="1">C. LUPPA 5</option><option value="2">C.LONGI M.RE
>> >> >> 1</option><option value="3">CUMPNOL/VILAN 2</option><option
>> >> >> value="4">CUMPINOGUPA 3</option><option value="5">DELO
>> >> >> 1</option><option value="6">DELO VABBHIO 1</option><option
>> >> >> value="7">FAELXO 2</option><option value="8">GHSSA'
>> 1</option><option
>> >> >> value="9">GWNA DELE 4</option><option value="10">GYNA MARUIT
>> >> >> 2</option><option value="11">ZWRTAFFAGO 1</option><option
>> >> >> value="12">ZWRTAFFAGO 2</option><option value="13">CITHNO
>> >> >> 1</option><option value="14">CITHNO 2</option><option
>> value="15">QOSLE
>> >> >> 1</option><option value="16">TIAZILA 1</option><option
>> >> >> value="17">WPFNEA 1</option><option value="18">WPFNEA
>> >> >> 2</option><option value="19">ATRT' 1</option><option
>> >> >> value="20">DICOWOJO 1</option>
>> >> >>
>> >> >> I tried with the following regular expression extractor:
>> >> >> reference name: selection
>> >> >> regular expression: name="VB_idCprel"><option selected
>> >> >> value="0"></option>(<option value="([0-9]{1,2})">[A-Z0-9\.
>> >> >> \'\/]{6,15}</option>)+
>> >> >> template: $2$
>> >> >> match no. 0 (i need a random value between 1 and 20)
>> >> >> default value: dummy
>> >> >>
>> >> >>
>> >> >> Match the characters "name="VB_idCprel"><option selected
>> >> >> value="0"></option>" literally
>> >> >> Match the regex below and capture its match into backreference 1
>> >> >> (<option value="([0-9]{1,2}){1,}">[A-Z0-9\. \'\/]{6,15}</option>)
>> >> >> Match the regex below and capture its match into backreference 2
>> >> >> ([0-9]{1,2})
>> >> >>
>> >> >> But repeating the capturing group 1 itself, it causes the group will
>> >> >> capture only the last iteraction. I should put a capturing group
>> >> >> around the repeated group to capture all iterations.
>> >> >>
>> >> >> So the n.th http request (get ${selection}.html gives me the value
>> 20
>> >> >> (get 20.html)
>> >> >>
>> >> >> Any suggestion????
>> >> >>
>> >> >> Michele Masè
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: [email protected]
>> >> >> For additional commands, e-mail:
>> [email protected]
>> >> >>
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: [email protected]
>> >> > For additional commands, e-mail: [email protected]
>> >> >
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [email protected]
>> >> For additional commands, e-mail: [email protected]
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>