Re: How can I extract cell data (content surrounded by ) from a in HTML response?

Wed, 18 Nov 2009 12:37:29 -0800

You should probably make the check case insensitive. but I agree with sebb ,
parsing html constructs with regex is a pain and breaks quite frequently
regards
deepak

On Wed, Nov 18, 2009 at 10:37 AM, Andre Arnold <[email protected]> wrote:

> sebb schrieb:
> > On 18/11/2009, rosiere <[email protected]> wrote:
> >
> >>  Hello,
> >>
> >>  I found that JMeter's oro regex is somehow different from java's.
> >>
> >
> > Yes.
> >
> > But not all that different; and neither is particularly well suited to
> > this task.
> >
> > The XPath Extractor will probably be much easier to use.
> >
> >
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#XPath_Extractor
> >
> > This was discussed on the mailing list earlier this year.
> >
> >
> >>  Now I need to iterate on different <tr> that matches a pattern, then:
> >>   capture all the <td> elements within each <tr> , and select the 8th
> and 9th
> >>  <td>.
> >>
> >>  Since many <tr> elements appears in the HTML response, in order to do
> this I
> >>  have to capture <tr> line by line without including two lines in a same
> >>  group:
> >>
> >>  so I should avoid capturing  continuous <tr>..</tr><tr>..</tr> into the
> same
> >>  group.
> >>
> >>  By writing (?is)<tr\sclass="tgDataLine.*1\)\" >(.*)</tr> I will capture
> only
> >>  one group that contains many real <tr> elements
> >>  So what should I write in the regex?
> >>
> >>
> If you still need a pattern to match your needs.
> I found that the following matches your the number you wanted and the
> following column value.
>
> reference: ref
> pattern:     (?s)<TR.+?<TD.+?>([1-9|0]+?)</TD.+?<TD.+?>(.+?)</TD>
> template:  $1$$2$
> match :     1
>
> In ref_g1 you'll find the number.
> In ref_g2 you'll find the following column value.
>
> To catch all the matches you need to increment a counter for the match
> and check wether there is another one or not.
>
> Your Testplan should look sth like this:
>
> -while controller (${__javaScript("${ref}"!="error")}  )
> --counter (from 1 with increment 1 for the regex match value)
> --Http Sampler (to get your site)
> ---RegEx Extractor (as shown above)
> --if controller( same as while controller--> ${ref}"!="error" )
> ---your jdbc action (use ref_g1 & ref_g2)
>
>
> Hope I got your problem right.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to