jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Chan" <a...@messagecast.net>
Subject Finding the number of occurences of a given string...
Date Wed, 19 May 2004 17:09:18 GMT
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

 

 

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message