Avalanche: Is it possible to use search criteria with the same prefix and postfix or to capture values that are not the first occurrence?
Knowledge Base - FAQ
Avalanche: Is it possible to use search criteria with the same prefix and postfix or to capture values that are not the first occurrence?
• Yes
• From the Avalanche online help:
ASSIGN VARIABLE
(This search uses inline definitions of the prefix and postfix strings. Enter a name for the temporary search criteria file identified as string2. You do not need to create this file ahead of time.)
•string1 — the variable that is assigned the search result
•string2—temporary search criteria filename (automatically created by Commander)
•string3—prefix match
•string4—postfix match
•integer1 — postfix occurrence
•integer2—search criteria (pattern) occurrence
•variable_location —where you search: Header/Body/Both
• Example 1: Test case goal is to capture each value between "amp;" and "amp;"
server response:
"/vodadi/test/ZZBB9999888800000001?BucketID=427&OpenForWrite=0&TransferRate=3750000&ClientTransfer=60.240.2.46&TimeStamp=1309950626.271&TimeOut=5000&MCSymbol=60817433.11.602643&SubtypeOrFilename=index"
Client action list examples with results:
1 get http://192.168.1.1/
ASSIGN VARIABLE " "amp;" 1 1 BODY> #var1 will get "/vodadi/test/ZZBB9999888800000001?BucketID=427&"
ASSIGN VARIABLE #var2 will get "OpenForWrite=0&"
ASSIGN VARIABLE #var3 will get "TransferRate=3750000&"
ASSIGN VARIABLE #var4 will get "ClientTransfer=60.240.2.46&"
ASSIGN VARIABLE #var5 will get "TimeStamp=1309950626.271&"
ASSIGN VARIABLE #var6 will get "TimeOut=5000"
ASSIGN VARIABLE #var7 will get "MCSymbol=60817433.11.602643&"
ASSIGN VARIABLE " 1 7 BODY> #var8 will get "SubtypeOrFilename=index"
1 get http://192.168.1.1/
Avalanche will send this request:
http://192.168.1.1/vodadi/test/ZZBB9999888800000001?BucketID=427&OpenForWrite=0&TransferRate=3750000&ClientTransfer=60.240.2.46&TimeStamp=1309950626.271&TimeOut=5000&MCSymbol=60817433.11.602643&SubtypeOrFilename=index
• Example 2: Test case goal is to capture bb and bb21cc to different variables
Server response: server response "1aa21bb21cc21dd21ee21ff2"
1 get http://192.168.1.1/
ASSIGN VARIABLE
#myvar1 = bb
ASSIGN VARIABLE
#myvar2 = bb21cc
• Example 3: Test case goal is to capture value between second _ and first "
Server response: %3D002b307522f0_122264640001_947523ddfg3664f4e568afb9d08dx"
1 get http://192.168.1.1/
ASSIGN VARIABLE
#hex values used for _ and " as double quotes cannot be used for in-line search criteria (e.g. """ results in a parse error however "%22" does not)
#myvar1 = 947523ddfg3664f4e568afb9d08dx