I did try anchoring to the start and end of the line with the pattern "
^(?!userName)([a-zA-Z0-9]+)\s+(?!password$)([a-zA-Z0-9]+)"

This regexp works when I test it using http://regexlib.com/RETester.aspx.
But I can't seem to get it to work with jmeter regular expression extractor.

Angelo.

-----Original Message-----
From: sebb [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 07, 2007 1:25 PM
To: JMeter Users List
Subject: Re: Running Regular Expression extractor on the results of JDBC
Requests

On 07/06/07, Angelo Di Placido <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to