You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by l_u_c_f_e_r_13 <sy...@globallogic.com> on 2008/11/04 16:36:40 UTC

Random match for RegExp

Hi.

Could somebody help me get random match from (it is two rows)
<div id="articles_dropmenu" class="dropmenudiv">
"<b /successskills_articles.html">Success Skills  "<b
/relationships_articles.html">Love &amp; Relationships  "<b
/healthfitness_articles.html">Health &amp; Fitness  "<b
/finances_articles.html">Money &amp; Careers  /mentalhealth_articles.html
Mental Health  "<b /spirituality_articles.html">Spirituality  "<b
/dietnutrition_articles.html">Lifestyle <hr />

RegExp is following
RefName: URL
RegExp: (?m)<div id="articles_dropmenu"
class="dropmenudiv">.*?\n.*?href="(.*?)">
Template: $1$
Match No: 0
Def: -1

This always get first match ((, and I need get different URLs, not always
the same.

TIA


-- 
View this message in context: http://www.nabble.com/Random-match-for-RegExp-tp20324679p20324679.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


Re: Random match for RegExp

Posted by sebb <se...@gmail.com>.
On 04/11/2008, l_u_c_f_e_r_13 <sy...@globallogic.com> wrote:
>
>
>
>  sebb-2-2 wrote:
>  >
>  > On 04/11/2008, l_u_c_f_e_r_13 <sy...@globallogic.com> wrote:
>  >>
>  >>  Hi.
>  >>
>  >>  Could somebody help me get random match from (it is two rows)
>  >>  <div id="articles_dropmenu" class="dropmenudiv">
>
> >>  "Success Skills  "  /relationships_articles.html">Love &amp;
>  >> Relationships  "  /healthfitness_articles.html">Health &amp; Fitness  "
>
> >> /finances_articles.html">Money &amp; Careers  /mentalhealth_articles.html
>
> >>  Mental Health  "Spirituality  "  /dietnutrition_articles.html">Lifestyle
>
> >> <hr />
>  >>
>  >>  RegExp is following
>  >>  RefName: URL
>  >>  RegExp: (?m)<div id="articles_dropmenu"
>  >>  class="dropmenudiv">.*?\n.*?href="(.*?)">
>  >>  Template: $1$
>  >>  Match No: 0
>  >>  Def: -1
>  >>
>  >>  This always get first match ((, and I need get different URLs, not
>  >> always
>  >>  the same.
>  >
>  > Try setting Match No: to -1; use the Debug Sampler to check that the
>  > RE really does match more than 1 entry.
>  >
>  > Or just try Match No: 2.
>  >
>  >>  TIA
>  >>
>  >>
>  >>
>  >>  --
>  >>  View this message in context:
>  >> http://www.nabble.com/Random-match-for-RegExp-tp20324679p20324679.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
>  >>
>  >>
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >
>  >
>  >
>
>
> That's the point - there is no match #2 or #3 etc. because of multiply

That was not at all clear from your original posting.
The choice of random match is not relevant if there is only one match.

>  lines. So if I set
>  RegExp: href="(.*?)">
>  then extractor will find all matches for this pattern. But in case of
>  multy-line Regexp it doesn't work. So I ask for help with RegExp because my
>  RegExp depends on first row and I can't omit it.
>

It's still far from clear what you are trying to do.

The original posting shows the HTML snippet as:

<div id="articles_dropmenu" class="dropmenudiv">
"<b /successskills_articles.html">Success Skills  "<b
/relationships_articles.html">Love &amp; Relationships  "<b
/healthfitness_articles.html">Health &amp; Fitness  "<b
/finances_articles.html">Money &amp; Careers  /mentalhealth_articles.html
Mental Health  "<b /spirituality_articles.html">Spirituality  "<b
/dietnutrition_articles.html">Lifestyle <hr />

and the RE appears to be trying to extract the contents of all the
"href" attributes in the HTML.

However, I don't see any "href" attributes.

You can test REs using the ORO demo at:

http://jakarta.apache.org/oro/demo.html

I suggest you have a play there first before posting again.

>
>  --
>  View this message in context: http://www.nabble.com/Random-match-for-RegExp-tp20324679p20327587.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
>
>

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


Re: Random match for RegExp

Posted by l_u_c_f_e_r_13 <sy...@globallogic.com>.


sebb-2-2 wrote:
> 
> On 04/11/2008, l_u_c_f_e_r_13 <sy...@globallogic.com> wrote:
>>
>>  Hi.
>>
>>  Could somebody help me get random match from (it is two rows)
>>  <div id="articles_dropmenu" class="dropmenudiv">
>>  "Success Skills  "  /relationships_articles.html">Love &amp;
>> Relationships  "  /healthfitness_articles.html">Health &amp; Fitness  " 
>> /finances_articles.html">Money &amp; Careers  /mentalhealth_articles.html
>>  Mental Health  "Spirituality  "  /dietnutrition_articles.html">Lifestyle
>> <hr />
>>
>>  RegExp is following
>>  RefName: URL
>>  RegExp: (?m)<div id="articles_dropmenu"
>>  class="dropmenudiv">.*?\n.*?href="(.*?)">
>>  Template: $1$
>>  Match No: 0
>>  Def: -1
>>
>>  This always get first match ((, and I need get different URLs, not
>> always
>>  the same.
> 
> Try setting Match No: to -1; use the Debug Sampler to check that the
> RE really does match more than 1 entry.
> 
> Or just try Match No: 2.
> 
>>  TIA
>>
>>
>>
>>  --
>>  View this message in context:
>> http://www.nabble.com/Random-match-for-RegExp-tp20324679p20324679.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
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
> 
> 

That's the point - there is no match #2 or #3 etc. because of multiply
lines. So if I set
RegExp: href="(.*?)">
then extractor will find all matches for this pattern. But in case of
multy-line Regexp it doesn't work. So I ask for help with RegExp because my
RegExp depends on first row and I can't omit it.

-- 
View this message in context: http://www.nabble.com/Random-match-for-RegExp-tp20324679p20327587.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


Re: Random match for RegExp

Posted by sebb <se...@gmail.com>.
On 04/11/2008, l_u_c_f_e_r_13 <sy...@globallogic.com> wrote:
>
>  Hi.
>
>  Could somebody help me get random match from (it is two rows)
>  <div id="articles_dropmenu" class="dropmenudiv">
>  "<b /successskills_articles.html">Success Skills  "<b
>  /relationships_articles.html">Love &amp; Relationships  "<b
>  /healthfitness_articles.html">Health &amp; Fitness  "<b
>  /finances_articles.html">Money &amp; Careers  /mentalhealth_articles.html
>  Mental Health  "<b /spirituality_articles.html">Spirituality  "<b
>  /dietnutrition_articles.html">Lifestyle <hr />
>
>  RegExp is following
>  RefName: URL
>  RegExp: (?m)<div id="articles_dropmenu"
>  class="dropmenudiv">.*?\n.*?href="(.*?)">
>  Template: $1$
>  Match No: 0
>  Def: -1
>
>  This always get first match ((, and I need get different URLs, not always
>  the same.

Try setting Match No: to -1; use the Debug Sampler to check that the
RE really does match more than 1 entry.

Or just try Match No: 2.

>  TIA
>
>
>
>  --
>  View this message in context: http://www.nabble.com/Random-match-for-RegExp-tp20324679p20324679.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
>
>

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