See bug 29201: http://issues.apache.org/bugzilla/show_bug.cgi?id=29021

The variable you need is called 
        refName_matchNr
not
        refName_matchNR
as per the documentation.

This is for the regex extractor (not the function, which does not set up the
variable).

Try a regular expression of the form:

        example \d

and set

        Match no: -1

S.
-----Original Message-----
From: Alan Chan [mailto:[EMAIL PROTECTED]
Sent: 19 May 2004 18:09
To: [EMAIL PROTECTED]
Subject: Finding the number of occurences of a given string...


Hi,

 

I've sent out this email before but got no responses back. I hope
someone can help me out this time.

 

Here is my question:

 

>From a given long string contained in a variable, I would like to get
the number of occurrences of a certain substring that I also provide.

 

For example, if I have a user defined variable called ${text} which
contains "example 1 example 2 example 3", and my substring to match is
"example", then the output should be 3.

 

I was trying to use regular expressions extractor and the regular
expressions function for this but could not figure out how to make it to
output the number of occurrences.

 

This is the Perl statement that I am trying to convert to something
JMeter can understand:

 

$text = "example 1 example 2 example 3";

print ($text =~ s/example/example/g);

 

the output is 3

 

 

I also tried using the extended Perl regular expressions, but couldn't
get it to work either.

 

Any help would be much appreciated.

 

Thanks,

~Alan Chan

 

 

 



___________________________________________________________________________

This e-mail and the documents attached are confidential and intended solely
for the addressee; it may also be privileged. If you receive this e-mail in
error, please notify the sender immediately and destroy it. As its integrity
cannot be secured on the Internet, the Atos Origin group liability cannot be
triggered for the message content. Although the sender endeavours to maintain
a computer virus-free network, the sender does not warrant that this
transmission is virus-free and will not be liable for any damages resulting
from any virus transmitted. 
___________________________________________________________________________


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

Reply via email to