${__regexFunction(<option value="([0-9]{1\,2})">([ABCDEFGHILMNOPRSTUVZ12\.
\'\/]{6\,15})</option>,$1$,RAND,,dummy,recupera_centro2,recupera_centro)should work You can use this anywhere so long as its after the first regex runs regards deepak On Mon, Dec 6, 2010 at 2:18 AM, Michele Mase' <[email protected]>wrote: > Thanx for the help; I have the same problem: I cannot use the 2 > regular expressions together ... (I'm not able to) > > This is the first regex: > Reference name: recupera_centro > Regex: name="VB_idCprel"><option selected > value="0">(</option>)[<optionvalue=\"0-9A-Z\. \'\//>]+\1 > Template: $1$ > Matchno: 1 > Default Value: dummy > > And the result is > > 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> > > The second regex is: > <option value=\"([0-9]{1,2})\">([ABCDEFGHILMNOPRSTUVZ12\. > \'\/]{6,15})</option> > > Where should I put the second regex? > I've tried the following: > 1) I've used the function helper to extract this function: > ${__regexFunction(<option > value=\"([0-9]{1,2})\">([ABCDEFGHILMNOPRSTUVZ12\. > \'\/]{6,15})</option>,$1$,RAND,ALL,dummy,recupera_centro2,recupera_centro) > I've put in on a user variable, no hope > 2) The same value of the case 1); I 've put it on a second regex extractor: > Reference name: recupera_centro2 > Regex: ${__regexFunction(<option > value=\"([0-9]{1,2})\">([ABCDEFGHILMNOPRSTUVZ12\. > \'\/]{6,15})</option>,$1$,RAND,,dummy1,var2,recupera_centro)} > Template: $1$ > Matchno: 0 > Default Value: dummy2 > > And again: no hope (i recive the value dummy2) > > Any suggestion/s? > Regards Michele > > > I've put this one > > On Thu, Dec 2, 2010 at 5:33 AM, Deepak Shetty <[email protected]> wrote: > > 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#__regexFunctionbutits > 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] > >>> > >>> > >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >

