jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gavin Maselino <gavinmasel...@hotmail.com>
Subject Re: Jmeter Regex advice - qualifier string after regex
Date Wed, 13 Nov 2013 19:49:42 GMT
Hi Robin. Your first solution works perfectly, and also thanks for the tip on non greedy matching
research. 



> On 13 Nov 2013, at 19:26, "Robin D. Wilson" <rwilson2@gmail.com> wrote:
> 
> Try this:
> 
> a href=([^>]*)><span>Foo2
> 
> That tells Regex to get everything in the () that doesn't include a '>' character...
> 
> Your other regex is actually getting this string:
> 
> 12354><span>Foo1<a href=12357
> 
> That's because by nature, the 'regex' is 'greedy' in its match. So it is matching all
characters after the first 'href=', and up to
> the '><span>Foo2' string.
> 
> Try googling "regex non greedy match", you will find multiple ways to handle this.
> 
> --
> Robin D. Wilson
> Sr. Director of Web Development
> KingsIsle Entertainment, Inc.
> VOICE: 512-777-1861
> http://www.kingsisle.com
> 
> 
> -----Original Message-----
> From: Gavin Maselino [mailto:gavinmaselino@hotmail.com] 
> Sent: Wednesday, November 13, 2013 11:11 AM
> To: user@jmeter.apache.org
> Subject: Jmeter Regex advice - qualifier string after regex
> 
> Hi
> So here is an example of the JMeter response I am struggling with:
> <div><a href=12354><span>Foo1<a href=12357><span>Foo2</div>
> The text I need to use regex on is the ahref next to Foo2 (12357).When I do this regex
on RegexTester.com (a href=(.*)><span>Foo2),
> it returns the href value for Foo1.
> Can anyone advise how I can get the ahref for Foo2?
> I cannot use XPath extraction as the real response I am using has hexademical in it so
a '<' is actually encoded as '\u003C'.  
> Thanks 
>                         
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Mime
View raw message