jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <shet...@gmail.com>
Subject Re: REGEX grouping issue
Date Tue, 30 Nov 2010 15:49:55 GMT
a)should be easier to just use an XPATH extractor
//select[@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' <michele.mase@gmail.com>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 <milamber@apache.org> 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: 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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message