You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Nop Lists <no...@gmail.com> on 2005/11/18 17:19:52 UTC

Strange behaviour of a regular expression

Hello,
I have a slight problem extracting a value from a http-resplonse...
I need to extract the "value" field of one customer from a list of customers
having the attribute "Kontoinhaber".
A sample list (with white spaces eliminated) is posted below.
Now my regular expression is

(?s)(name=\"authPersonIdSeq\" value=\"([0-9]+)\".+?Kontoinhaber)
I take template $2$ , match 1.

Unfortunately I always get in my extractor the value of the first customer
which sometimes has the attribute "Bevollmächtigter" and not "Kontoinhaber".
Could anybody please advice what I am doing wrong?
Thanks!




<tr><td>
<input type="checkbox" name="authPersonIdSeq" value="5985094000100"
checked="checked">
Andreas Miller; Bevollmächtigter<br>
</td></tr>
<tr>
<td><img src="img/trans.gif" width="1" height="4" border="0" alt=""></td>
</tr>

<tr><td>
<input type="checkbox" name="authPersonIdSeq" value="0813421000100">
Damian Bart; Bevollmächtigter<br>
</td></tr>
<tr>
<td><img src="img/trans.gif" width="1" height="4" border="0" alt=""></td>
</tr>

<tr><td>
<input type="checkbox" name="authPersonIdSeq" value="8670010001000">
Elias Anton; Kontoinhaber<br>
</td></tr>
<tr>
<td><img src="img/trans.gif" width="1" height="4" border="0" alt=""></td>
</tr>

<tr><td>
<input type="checkbox" name="authPersonIdSeq" value="0799894000100">
Benedikt Press; Bevollmächtigter<br>
</td></tr>
<tr>
<td><img src="img/trans.gif" width="1" height="4" border="0" alt=""></td>
</tr>

<tr><td>
<input type="checkbox" name="authPersonIdSeq" value="6058654000100">
Dr. Parsad Mau; Bevollmächtigter<br>
</td></tr>
<tr>

Re: Strange behaviour of a regular expression

Posted by Nop Lists <no...@gmail.com>.
Yes, that was the sollution.
Thanks a lot everybody for the quick responses!!

On 11/18/05, sebb <se...@gmail.com> wrote:
>
> On 18/11/05, Nop Lists <no...@gmail.com> wrote:
> > Hello,
> > I have a slight problem extracting a value from a http-resplonse...
> > I need to extract the "value" field of one customer from a list of
> customers
> > having the attribute "Kontoinhaber".
> > A sample list (with white spaces eliminated) is posted below.
> > Now my regular expression is
> >
> > (?s)(name=\"authPersonIdSeq\" value=\"([0-9]+)\".+?Kontoinhaber)
>
> This means find
>
> name="authPersonIdSeq" value="\d+"
>
> where this is (eventually) followed by
>
> Kontoinhaber
>
> .+? is not greedy, but it will still keep going until it finds a match
> for Kontoinhaber.
>
> Try [^<]+? instead
>
> > I take template $2$ , match 1.
> >
> > Unfortunately I always get in my extractor the value of the first
> customer
> > which sometimes has the attribute "Bevollmächtigter" and not
> "Kontoinhaber".
> > Could anybody please advice what I am doing wrong?
> > Thanks!
> >
> >
> >
> >
> > <tr><td>
> > <input type="checkbox" name="authPersonIdSeq" value="5985094000100"
> > checked="checked">
> > Andreas Miller; Bevollmächtigter<br>
> > </td></tr>
> > <tr>
> > <td><img src="img/trans.gif" width="1" height="4" border="0"
> alt=""></td>
> > </tr>
> >
> > <tr><td>
> > <input type="checkbox" name="authPersonIdSeq" value="0813421000100">
> > Damian Bart; Bevollmächtigter<br>
> > </td></tr>
> > <tr>
> > <td><img src="img/trans.gif" width="1" height="4" border="0"
> alt=""></td>
> > </tr>
> >
> > <tr><td>
> > <input type="checkbox" name="authPersonIdSeq" value="8670010001000">
> > Elias Anton; Kontoinhaber<br>
> > </td></tr>
> > <tr>
> > <td><img src="img/trans.gif" width="1" height="4" border="0"
> alt=""></td>
> > </tr>
> >
> > <tr><td>
> > <input type="checkbox" name="authPersonIdSeq" value="0799894000100">
> > Benedikt Press; Bevollmächtigter<br>
> > </td></tr>
> > <tr>
> > <td><img src="img/trans.gif" width="1" height="4" border="0"
> alt=""></td>
> > </tr>
> >
> > <tr><td>
> > <input type="checkbox" name="authPersonIdSeq" value="6058654000100">
> > Dr. Parsad Mau; Bevollmächtigter<br>
> > </td></tr>
> > <tr>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: Strange behaviour of a regular expression

Posted by sebb <se...@gmail.com>.
On 18/11/05, Nop Lists <no...@gmail.com> wrote:
> Hello,
> I have a slight problem extracting a value from a http-resplonse...
> I need to extract the "value" field of one customer from a list of customers
> having the attribute "Kontoinhaber".
> A sample list (with white spaces eliminated) is posted below.
> Now my regular expression is
>
> (?s)(name=\"authPersonIdSeq\" value=\"([0-9]+)\".+?Kontoinhaber)

This means find

     name="authPersonIdSeq" value="\d+"

where this is (eventually) followed by

    Kontoinhaber

.+? is not greedy, but it will still keep going until it finds a match
for Kontoinhaber.

Try [^<]+? instead

> I take template $2$ , match 1.
>
> Unfortunately I always get in my extractor the value of the first customer
> which sometimes has the attribute "Bevollmächtigter" and not "Kontoinhaber".
> Could anybody please advice what I am doing wrong?
> Thanks!
>
>
>
>
> <tr><td>
> <input type="checkbox" name="authPersonIdSeq" value="5985094000100"
> checked="checked">
> Andreas Miller; Bevollmächtigter<br>
> </td></tr>
> <tr>
> <td><img src="img/trans.gif" width="1" height="4" border="0" alt=""></td>
> </tr>
>
> <tr><td>
> <input type="checkbox" name="authPersonIdSeq" value="0813421000100">
> Damian Bart; Bevollmächtigter<br>
> </td></tr>
> <tr>
> <td><img src="img/trans.gif" width="1" height="4" border="0" alt=""></td>
> </tr>
>
> <tr><td>
> <input type="checkbox" name="authPersonIdSeq" value="8670010001000">
> Elias Anton; Kontoinhaber<br>
> </td></tr>
> <tr>
> <td><img src="img/trans.gif" width="1" height="4" border="0" alt=""></td>
> </tr>
>
> <tr><td>
> <input type="checkbox" name="authPersonIdSeq" value="0799894000100">
> Benedikt Press; Bevollmächtigter<br>
> </td></tr>
> <tr>
> <td><img src="img/trans.gif" width="1" height="4" border="0" alt=""></td>
> </tr>
>
> <tr><td>
> <input type="checkbox" name="authPersonIdSeq" value="6058654000100">
> Dr. Parsad Mau; Bevollmächtigter<br>
> </td></tr>
> <tr>
>
>

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


Re: Strange behaviour of a regular expression

Posted by sebb <se...@gmail.com>.
Or rather:

match 2 won't always pick up the correct section of the response;
and $1$ will return the whole section, not just the number.

S.
On 18/11/05, sebb <se...@gmail.com> wrote:
> That will only work in some cases.
>
> S.
> On 18/11/05, Bruno Charloup <bc...@jouve.fr> wrote:
> > Let template $1$, and try match 2
> >
> > -----Message d'origine-----
> > De : Nop Lists [mailto:nop.lists@gmail.com]
> > Envoyé : vendredi 18 novembre 2005 17:20
> > À : jmeter
> > Objet : Strange behaviour of a regular expression
> >
> > Hello,
> > I have a slight problem extracting a value from a http-resplonse...
> > I need to extract the "value" field of one customer from a list of customers
> > having the attribute "Kontoinhaber".
> > A sample list (with white spaces eliminated) is posted below.
> > Now my regular expression is
> >
> > (?s)(name=\"authPersonIdSeq\" value=\"([0-9]+)\".+?Kontoinhaber)
> > I take template $2$ , match 1.
> >
> > Unfortunately I always get in my extractor the value of the first customer
> > which sometimes has the attribute "Bevollmächtigter" and not "Kontoinhaber".
> > Could anybody please advice what I am doing wrong?
> > Thanks!
> >
> >
> >
> >
> > <tr><td>
> > <input type="checkbox" name="authPersonIdSeq" value="5985094000100"
> > checked="checked">
> > Andreas Miller; Bevollmächtigter<br>
> > </td></tr>
> > <tr>
> > <td><img src="img/trans.gif" width="1" height="4" border="0" alt=""></td>
> > </tr>
> >
> > <tr><td>
> > <input type="checkbox" name="authPersonIdSeq" value="0813421000100"> Damian
> > Bart; Bevollmächtigter<br> </td></tr> <tr> <td><img src="img/trans.gif"
> > width="1" height="4" border="0" alt=""></td> </tr>
> >
> > <tr><td>
> > <input type="checkbox" name="authPersonIdSeq" value="8670010001000"> Elias
> > Anton; Kontoinhaber<br> </td></tr> <tr> <td><img src="img/trans.gif"
> > width="1" height="4" border="0" alt=""></td> </tr>
> >
> > <tr><td>
> > <input type="checkbox" name="authPersonIdSeq" value="0799894000100">
> > Benedikt Press; Bevollmächtigter<br> </td></tr> <tr> <td><img
> > src="img/trans.gif" width="1" height="4" border="0" alt=""></td> </tr>
> >
> > <tr><td>
> > <input type="checkbox" name="authPersonIdSeq" value="6058654000100"> Dr.
> > Parsad Mau; Bevollmächtigter<br> </td></tr> <tr>
> >
> >
> > ---------------------------------------------------------------------
> > 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: Strange behaviour of a regular expression

Posted by sebb <se...@gmail.com>.
That will only work in some cases.

S.
On 18/11/05, Bruno Charloup <bc...@jouve.fr> wrote:
> Let template $1$, and try match 2
>
> -----Message d'origine-----
> De : Nop Lists [mailto:nop.lists@gmail.com]
> Envoyé : vendredi 18 novembre 2005 17:20
> À : jmeter
> Objet : Strange behaviour of a regular expression
>
> Hello,
> I have a slight problem extracting a value from a http-resplonse...
> I need to extract the "value" field of one customer from a list of customers
> having the attribute "Kontoinhaber".
> A sample list (with white spaces eliminated) is posted below.
> Now my regular expression is
>
> (?s)(name=\"authPersonIdSeq\" value=\"([0-9]+)\".+?Kontoinhaber)
> I take template $2$ , match 1.
>
> Unfortunately I always get in my extractor the value of the first customer
> which sometimes has the attribute "Bevollmächtigter" and not "Kontoinhaber".
> Could anybody please advice what I am doing wrong?
> Thanks!
>
>
>
>
> <tr><td>
> <input type="checkbox" name="authPersonIdSeq" value="5985094000100"
> checked="checked">
> Andreas Miller; Bevollmächtigter<br>
> </td></tr>
> <tr>
> <td><img src="img/trans.gif" width="1" height="4" border="0" alt=""></td>
> </tr>
>
> <tr><td>
> <input type="checkbox" name="authPersonIdSeq" value="0813421000100"> Damian
> Bart; Bevollmächtigter<br> </td></tr> <tr> <td><img src="img/trans.gif"
> width="1" height="4" border="0" alt=""></td> </tr>
>
> <tr><td>
> <input type="checkbox" name="authPersonIdSeq" value="8670010001000"> Elias
> Anton; Kontoinhaber<br> </td></tr> <tr> <td><img src="img/trans.gif"
> width="1" height="4" border="0" alt=""></td> </tr>
>
> <tr><td>
> <input type="checkbox" name="authPersonIdSeq" value="0799894000100">
> Benedikt Press; Bevollmächtigter<br> </td></tr> <tr> <td><img
> src="img/trans.gif" width="1" height="4" border="0" alt=""></td> </tr>
>
> <tr><td>
> <input type="checkbox" name="authPersonIdSeq" value="6058654000100"> Dr.
> Parsad Mau; Bevollmächtigter<br> </td></tr> <tr>
>
>
> ---------------------------------------------------------------------
> 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: Strange behaviour of a regular expression

Posted by Bruno Charloup <bc...@jouve.fr>.
Let template $1$, and try match 2 

-----Message d'origine-----
De : Nop Lists [mailto:nop.lists@gmail.com] 
Envoyé : vendredi 18 novembre 2005 17:20
À : jmeter
Objet : Strange behaviour of a regular expression

Hello,
I have a slight problem extracting a value from a http-resplonse...
I need to extract the "value" field of one customer from a list of customers
having the attribute "Kontoinhaber".
A sample list (with white spaces eliminated) is posted below.
Now my regular expression is

(?s)(name=\"authPersonIdSeq\" value=\"([0-9]+)\".+?Kontoinhaber)
I take template $2$ , match 1.

Unfortunately I always get in my extractor the value of the first customer
which sometimes has the attribute "Bevollmächtigter" and not "Kontoinhaber".
Could anybody please advice what I am doing wrong?
Thanks!




<tr><td>
<input type="checkbox" name="authPersonIdSeq" value="5985094000100"
checked="checked">
Andreas Miller; Bevollmächtigter<br>
</td></tr>
<tr>
<td><img src="img/trans.gif" width="1" height="4" border="0" alt=""></td>
</tr>

<tr><td>
<input type="checkbox" name="authPersonIdSeq" value="0813421000100"> Damian
Bart; Bevollmächtigter<br> </td></tr> <tr> <td><img src="img/trans.gif"
width="1" height="4" border="0" alt=""></td> </tr>

<tr><td>
<input type="checkbox" name="authPersonIdSeq" value="8670010001000"> Elias
Anton; Kontoinhaber<br> </td></tr> <tr> <td><img src="img/trans.gif"
width="1" height="4" border="0" alt=""></td> </tr>

<tr><td>
<input type="checkbox" name="authPersonIdSeq" value="0799894000100">
Benedikt Press; Bevollmächtigter<br> </td></tr> <tr> <td><img
src="img/trans.gif" width="1" height="4" border="0" alt=""></td> </tr>

<tr><td>
<input type="checkbox" name="authPersonIdSeq" value="6058654000100"> Dr.
Parsad Mau; Bevollmächtigter<br> </td></tr> <tr>


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