So, I have implemented enough that the first built-in function is now functional.  
There is no 
GUI help for writing it yet, so using it will be a complete mystery to ya'll.  

Briefly, it's a function that let's you write a regular expression to grab a string 
from
the previous response text and make a new string with it.  The arguments are:

1. The regular expression to apply to the response text
2. How to generate a new string.  This is like a template string that includes groups 
from the 
regular expression.  You'll need to learn something about Perl regular expressions to 
understand this part.  You can refer to any particular group in your regular 
expression with a 
syntax like $1$ (gets replaced with the first group from your regex).
3. Which match to use.  Your regex might find multiple matches.  You can pick a number 
(1 is 
the first match, 2 the second, etc), you can use RAND to indicate JMeter should pick 
one at 
random, ALL means to use all matches (this is kinda complicated, so nevermind for now).
4.  The between text.  Say what?  Has to do with that ALL option mentioned above.
5.  Default text.  If your regex doesn't match, you can set the default string to use 
instead.

3,4, and 5 are optional and can be entirely absent.

Example:
${__regexFunction(<a href="(/[^"]*)",$1$,RAND,,/index.html)}

This finds links that start with '/' and groups the path to be used in the template.  
The template 
is simply the path parsed from the regex.  A random match will be chosen each time the 
function is run, no between text is given, and the default is string if no match is 
found is 
'/index.html'.

If you need to use a comma in any of these values, you'll need to use the HTTP 
encoding for 
a comma, which you'll have to look up yourself.

I was surprisingly easy to use.  The hardest part is writing the regular expression, 
which 
shouldn't be much of a surprise, I guess.

--
Michael Stover
[EMAIL PROTECTED]
Yahoo IM: mstover_ya
ICQ: 152975688

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

Reply via email to