jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: Running Regular Expression extractor on the results of JDBC Requests
Date Thu, 07 Jun 2007 17:25:14 GMT
On 07/06/07, Angelo Di Placido <angelod@talkshoe.com> wrote:
> Hello All,
>
>
>
> I am running the jdbc request sampler to execute a query "select userName,
> password from User limit 10" against a mysql database.  The result that
> comes back is:
>
>
>
> userName         password
>
> user1    password1
>
[...]
> user10  password10
>
> Now I would like to create a regular expression that extracts all the users
> and passwords and use the results in a foreach type controller.  Problem is
> I need to not match "userName     password".
>
>
>
> I have tried the regular expression
> "(?!userName)([a-zA-Z0-9]+)\s+([a-zA-Z0-9]+)" .  This does not match
> "userName" but does match "serName"!
>

That's how negative lookahead is supposed to work.

When the text is "userName" it sees "userName" and fails.
But when it reaches "serName" it succeeds.

>
>
> So the problem is solved either:
>
> 1. not having the jdbc request sampler return the heading row ("userName
> password"), or
>
> 2. fix the regular expression
>

Negative lookahead is not much use at the start of an RE, as you have found.

Try either

"^(?!userName)([a-zA-Z0-9]+)\s+([a-zA-Z0-9]+)"

which anchors the negative match, or

"([a-zA-Z0-9]+)\s+(?!password)([a-zA-Z0-9]+)"

which uses the leading \s+ to anchor the NLA or even

"^(?!userName)([a-zA-Z0-9]+)\s+(?!password)([a-zA-Z0-9]+)"

to reject username and password.

>
> Any help would be appreciated.
>
>
>
> Thanks,
>
>
>
> Angelo.
>
>
>
>

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


Mime
View raw message