jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <shet...@gmail.com>
Subject Re: problem in reading variable set by capturing groups in regex with "Match No." set to negative
Date Mon, 23 Nov 2009 17:52:02 GMT
Hi
For Each (inputVar = tgDataColumn , returnVar = anything, ignored)
+Counter  (Add this config element,
start=1,increment=1,maximum=${tgDataColumn_matchNr}, referenceName=C)

use ${__javaScript(vars.get("tgDataColumn_" + vars.get("C") + "_g1"))}  to
get the 1st group. If you want to iterate over all groups (though i think
you just want the 8th group/9th group) use ForEach with
inputVar=refName_${C}_g

regards
deepak


On Mon, Nov 23, 2009 at 9:39 AM, rosiere <shu.yi.eutech@gmail.com> wrote:

>
> Hello,
>
> In fact my superior just spent lot of time on regex and did not want to
> give
> it up.
>
> As for XPath, I also tried it and met problems like " Server returned HTTP
> response code: 503 for URL: http://www.w3.org/TR/html4/loose.dtd".
>
> I found an article that told me that the bug was fixed but not released in
> the latest version. So should I use the nightly build after 789187?
>
>
> http://mail-archives.apache.org/mod_mbox/jakarta-jmeter-user/200909.mbox/%3C25aac9fc0909040922j55a1f563t2e29b27eed189731@mail.gmail.com%3E
>
>
>
> rosiere wrote:
> >
> > Hello,
> >
> > I want to parse an html <table>'s content, and create an HTTP request on
> > each of its <tr> elements. The Http request will use some <td> element's
> > content as its parameter, according to predefined rules. So I used a
> regex
> > to capture a <td>'s content as a group, on these <tr>.
> >
> > (I did not use XPath because I'm not sure if the initial html <table> and
> > the page that contains it are well-formed.)
> >
> > This is my regular expression (say that I have only two cells in each
> > wanted tr. The cell's class must be  "tgDataColumn", and I want to
> capture
> > their content):
> >
> > <TD
> >
> class=(?:\"tgDataColumn\"|tgDataColumn)(?:.*index=[\d+]\'\">)(.*)</TD>\n<TD
> > class=(?:\"tgDataColumn\"|tgDataColumn)(?:.*index=[\d+]\'\">)(.*)</TD>\n
> >
> >
> >
> > I will use it to capture all occurrences (all <tr> that contains
> > "class=tgDataColumn" or "class="tgDataColumn"") in a HTML, then, in a
> > foreach controller whose "Input variable prefix" is set to "myRef" (the
> > "Reference Name" of my regex extrazctor), I want to reference to
> variables
> > created by regex, with:
> > "myRef_n_gm" syntax. I created a Http sampler, that uses each group
> > ${myRef_n_gm}'s value  as a parameter.
> >
> > However under my foreach controller, I'm unable to find these myRef_n_gm
> > variables' value, and at last they are represented like literals:
> > "${myRef_n_g0}", "${myRef_n_g1}", etc...
> >
> > The only thing I can do is capture the td's content and write it into a
> > template of regex extractor - A=$1$&B=$2$, then use the concatenated
> > template value  (like "A=xx&B=yy") as a whole, in my foreach controller.
> >
> >
> > What did I miss?
> >
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/problem-in-reading-variable-set-by-capturing-groups-in-regex-with-%22Match-No.%22-set-to-negative-tp26475373p26482688.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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