ROPE Language Reference - "expecti_str".

Checks that the specified string(s) are found at the current offset ($offset) in the packet buffer and advances the offset if a match is found. If no match is found, it flags a mismatch as if the "no" action was invoked. The matching of the packet against the specified string is done ignoring the case of letters (ie: "A" matches both "a" and "A").

For example:

"/rope/versions.php" $u put
expecti_str( "Get " $u " HTTP/1.1" )

This script stores the name of a web page URL in the user register $u, and then verifies that the packet contains the string "Get " followed by the contents of $u followed by " HTTP/1.1". If all three strings are found in the specified order at the current offset ($offset) then the offset is advanced to the end of the found strings. If the packet does not match the strings then the script is terminated with a "no" status.

If the AnchorBrackets syntax is used (as in the example), then expect_str checks all the specified strings, in the order in which they are specified. Without AnchorBrackets, it just checks the one string on the top of the stack against the packet contents.

Note: expect_str does the same thing, but does not ignore the case of any letters during the comparison.

See Also