Hi
ok , can you post a sample snippet of the text against which you are running
the regex with what the data is that you want to extract. Its sort of hard
to read the regex without knowing what we are trying to extract
One of the optimization hints provided by sebb is that
whatever(.+?), --> Any number of any characters(but atleast 1) followed by
comma but match the least amount
should be changed to
whatever[^,]+, --> Any number of any characters which isnt a comma
In the latter case the regex engine will stop as soon as it finds a comma ,
but in the former it might backtrack (Im not sure if i changed the semantics
in the example, but the principle is that the greedy/lazy
quantifiers(question mark) can cause the regex engine to backtrack and it
has to save intermediate results etc.. )
The book Mastering Regex has a bunch of optimisation hints and explanations
Ive also found that XPATH extractors are simpler to write and understand(but
not as flexible) though im not sure how they compare for performance, i
think they might be faster for some scenarios.
regards
deepak
On Fri, Sep 25, 2009 at 1:00 AM, Mark Stephen S. Florencio <
[email protected]> wrote:
> I have not really thought of a way to address that yet. I actually am just
> trying reg ex for the first time. I am fortunate that I am able to write
> scripts with functioning reg ex already.
> However, I am having another stumbling block.
>
> Can I ask regex questions here? If irs not really possible then you can
> disregard this email. You guys have been a lot of help anyway already.
>
> I have a regex that looks like this:
>
> \<a href=\"#\"\s\w{7}=\"if\(typeof jsfcljs ==
> \'function\'\)\{jsfcljs\(document.forms\[\'(.+?)\'],\'(.+?),(.+?),\w{15},(\d{1,3}),\w{24},(\d{1,3})\',\'\'\);\}return
> false\"\>\w{4}\<\a\>
>
> The first match is the one I need. Well the ones I actually need appears in
> the response for at least 3 times. I intend to get a random one from the
> matches to be used in a sampler parameter.
>
> My problem is that the 2nd to nth matches are too long. They include things
> that I do not need. The cause of it is the third group... I only used (.+?)
> for it. Is there a way I can get something like
> 'j_id_id37:j_id_id39:1:j_id_id131' with a different expression? The only
> thing I can assume is that the string length stays the same give or take 1
> or 2 of the last digits.
>
> ----- Original Message -----
> From: "Deepak Shetty" <[email protected]>
> To: "JMeter Users List" <[email protected]>
> Sent: Friday, September 25, 2009 12:55:52 PM
> Subject: Re: Reg Ex Extractor issue- stops my test execution
>
> I believe .+? makes regex's slow.
>
> On Thu, Sep 24, 2009 at 9:49 PM, Mark Stephen S. Florencio <
> [email protected]> wrote:
>
> > Good day,
> >
> > Thanks as always for the quick replies.
> >
> > So my new regex looks like this now. And it makes the test finish slower
> > though.
> >
> > \<a href\=\"\#\" onclick\=\"if\(typeof jsfcljs ==
> >
> \'function\'\)\{jsfcljs\(document.forms\[\'(.+?)\'\],\'(.+?),(.+?),bmyearid,(\d{1,3})\',\'\'\);\}return
> > false"\>Set\sBudget\/Target\<\/a\>
> >
> > my previous regex looks like this
> > orms\[\'(.+?)\'\],\'(.+?),(.+?),bmyearid,(\d{1,3})\',\'\'\);\}return
> > false"\>Set\sBudget\/Target
> >
> > As you can see the old one is just a subset of the new one. I thought I
> > need not be very specific but then It encountered problem when against
> the
> > whole response.
> >
> > Best regards,
> > Stephen
> >
> >
> > ----- Original Message -----
> > From: "Deepak Shetty" <[email protected]>
> > To: "JMeter Users List" <[email protected]>
> > Sent: Friday, September 25, 2009 12:14:15 PM
> > Subject: Re: Reg Ex Extractor issue- stops my test execution
> >
> > hi
> > i havent looked at the underlying code , so i dont know(id guess that
> > jmeter
> > should show similar behavior to the package). I guess Jmeter + regex
> > package
> > will always have a higher probability of a bug(than just the regex
> > package),
> > having said that Ive never run into any issues.
> > Whats your regex look like?
> >
> > regards
> > deepak
> >
> > On Thu, Sep 24, 2009 at 9:03 PM, Mark Stephen S. Florencio <
> > [email protected]> wrote:
> >
> > > Good day,
> > >
> > > Well i think my previous reg ex was still ambiguous. I was just testing
> > it
> > > with a subset of the response. I initially thought that was ok.. then I
> > > followed your advice... My old reg ex did not return anything and was
> > taking
> > > rather a long time to compile in the tester with the whole response to
> be
> > > searched in the tester. So I made a new reg ex and I guess I made it
> more
> > > descriptive.
> > >
> > > Still, the tester took quite a while with my new reg ex with
> > > searching/parsing the whole response. Will Jmeter be behaving
> similarly?
> > If
> > > so, isn't that making my test less reliable?
> > >
> > > Best regards,
> > >
> > > Stephen
> > > ----- Original Message -----
> > > From: "Deepak Shetty" <[email protected]>
> > > To: "JMeter Users List" <[email protected]>
> > > Sent: Friday, September 25, 2009 11:10:24 AM
> > > Subject: Re: Reg Ex Extractor issue- stops my test execution
> > >
> > > Can you disable the regex extractor and get the response data for your
> > > request and try it out on the tester? (i.e. run the regex against the
> > > actual
> > > data in a separate tool and see if it works). if that works what does
> > your
> > > regular expression look like and what options have you selected?
> > >
> > >
> > > On Thu, Sep 24, 2009 at 8:06 PM, Mark Stephen S. Florencio <
> > > [email protected]> wrote:
> > >
> > > > Let me qualify the description of my situation. It just hangs. I mean
> > it
> > > is
> > > > like waiting for something. The green indicator in the upper right is
> > > just
> > > > green as I wirte this. There is no error in the log as far as I
> > inspect
> > > it.
> > > > The test runs perfectly with disabling the reg ex extractor.
> > > >
> > > > The only thing I can see as an error in the log is this line.
> > > > 2009/09/25 11:04:07 INFO - jmeter.engine.StandardJMeterEngine:
> Thread
> > > will
> > > > continue on error
> > > >
> > > > Best regards,
> > > >
> > > > ----- Original Message -----
> > > > From: "Deepak Shetty" <[email protected]>
> > > > To: "JMeter Users List" <[email protected]>
> > > > Sent: Friday, September 25, 2009 10:54:36 AM
> > > > Subject: Re: Reg Ex Extractor issue- stops my test execution
> > > >
> > > > check jmeter.log under the bin directory for errors.
> > > > regards
> > > > deepak
> > > >
> > > > On Thu, Sep 24, 2009 at 7:51 PM, Mark Stephen S. Florencio <
> > > > [email protected]> wrote:
> > > >
> > > > > Good day.
> > > > >
> > > > > Can the reg Ex extractor overwhelm my system running Jmeter? I am
> > > > designing
> > > > > a script. I want to put a reg ex extractor in one of my samples.
> The
> > > reg
> > > > ex
> > > > > I am using is already tested using
> > > > http://jakarta.apache.org/oro/demo.html.
> > > > > So I guess it will run properly. I haven't even indicated in the
> > script
> > > > > where I will put the things I would have matched with the regex. As
> I
> > > ran
> > > > > the test, it just stops before the sampler that has the reg ex
> > > extractor.
> > > > >
> > > > > Any suggestions to overcome this predicament?
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > 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]
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > 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]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>