Using The Regex Coach <sp>cat<sp>.*?id=(\d+)<sp> gets 15 from the following example
<form> blah blah cat blah blah noid blah blah </form> <form> blah blah horse blah blah id=15 blah blah </form> What I think I need is a search within a backreference (<form.*<sp>cat<sp>.*?</form)\1id=(\d+)<sp> however this does not work within The Regex Coach. I tried this inside JMeter RegExp Extractor regex: (<form.*<sp>cat<sp>.*?</form) template: $1$id=(\d+)<sp> but that did not work either. What am I missing? Thanks, Andrew --- "BAZLEY, Sebastian" <[EMAIL PROTECTED]> wrote: > The regex extractor and function both allow one to > specify a default value, > which is returned if the regex does not match. > > Try it and see. > > You can use a dummy JavaSampler to display the > contents of any variable(s) > by including a reference to the variable(s). > > S. > -----Original Message----- > From: Andrew Roughan [mailto:[EMAIL PROTECTED] > Sent: 03 August 2004 06:20 > To: JMeter Users List > Subject: RE: How to parse responses > > > Thanks for the response Sebastian. > > I think the suggestion will work well for the first > part of my requirement: > > I want to extract the value of id from the form > > section where the text includes cat. e.g. 54 > > However, I don't think it will work for this second > part: > > Further, if id= does not exist within the form > > section where the text includes cat, then return > > false or similar. > > e.g. If the response was like this: > > <form> > blah blah dog blah blah id=32 blah blah > </form> > <form> > blah blah cat blah blah noid blah blah > </form> > <form> > blah blah horse blah blah id=15 blah blah > </form> > > in this case I think the suggested regexp would > return > 15? > > I was thinking that ForEach may assist if I actually > had to go through a list of extracted values (e.g. > dog > id=32, cat id=54, horse id=15). However this may not > be necessary. > > Cheers, > Andrew > > --- "BAZLEY, Sebastian" > <[EMAIL PROTECTED]> wrote: > > Try a regex of the form > > > > <sp>cat<sp>.*?id=(\d+)<sp> > > > > where <sp> = space. > > > > You don't say how you want to use the id value, so > > it is not clear whether > > the ForEach controller would be useful or not. > > > > See the JMeter Wiki for a pointer to a very useful > > regex tester. > > > > S. > > -----Original Message----- > > From: Andrew Roughan > [mailto:[EMAIL PROTECTED] > > Sent: 22 July 2004 13:30 > > To: [EMAIL PROTECTED] > > Subject: How to parse responses > > > > > > Hi, Can someone please tell me whether what I want > > to > > do is possible, and if it is, give a suggestion on > > how > > it can be done? > > > > If I have a HTML response similar to > > > > ... > > <form> > > blah blah dog blah blah id=32 blah blah > > </form> > > <form> > > blah blah cat blah blah id=54 blah blah > > </form> > > <form> > > blah blah horse blah blah id=15 blah blah > > </form> > > ... > > > > I want to extract the value of id from the form > > section where the text includes cat. e.g. 54 > > > > Further, if id= does not exist within the form > > section where the text includes cat, then return > > false > > or similar. > > > > I've looked at Regular Expression Extractor (using > > <form.*?</form as a start) and the ForEach > > Controller > > and but I haven't yet worked out how this could be > > done. If this is possible, I sure would like a > > pointer > > on how to go about it. If it isnt, knowing that > > would > > be good too! > > > > Thanks, > > Andrew Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

