Extracting a Web Page's Content using Delimiters
The Text tab in the
Parse/Check view (bottom part of the HTTP Data window) can be used
to add a SubStr function
on an HTTP request.
This function extracts a substring from a web page by locating it with left and right delimiters and an optional offset or occurence.
The left delimiter can be:
- A character String: The parsing function tries to locate the specified character string in the web page and extracts all the characters until the right delimiter in encountered. If the Exclude option is checked, the left delimiter is not included in the output string.
- A Position: The parsing function extracts the characters starting from the specified position until the right delimiter is encountered. If the Exclude option is checked, the character located at the specified position is not included in the output string.
The right delimiter can be:
- A character String: The parsing function resolves the left delimiter, it will try to locate the right delimiter character string and extracts the characters starting from the left delimiter until the right delimiter. If the Exclude option is checked, the left and right delimiters are not included in the output string.
- A length: The parsing function resolves the left delimiter and extracts "Length" characters.
If you want to extract the Nth occurence of a character string, check the Random/Occurence/Offset option, check the Occurence option and specify an occurence in the Occurence field.
If you want to extract a random occurence of a character string, check the Random/Occurence/Offset option and check the Random option.
There are occasions when it is useful to use the above methods starting from some point within the web page, rather than at the beginning. This can be achieved by resetting the selection base.
This can be done by checking the Random/Occurence/Offset option, checking the Offset options and specifying:
- The selection base as a Position from the beginning of the web page,
- or by specifying a character String that identifies the characters at the beginning of the substring to be examined.
The following options can be specified:
No Case All specified string comparisons are by default case sensitive. The case of characters can be ignored in comparisons by checking the No case option. Regular Expression String delimiters are treated like regular expressions. See Regular Expressions in AgileLoad for more information about regular expressions syntax supported. Exclude By default, the delimiter strings specified (left and right) are included in the returned substring. Both delimiters may be excluded from the returned substring by specifying the Exclude option. Reverse With Occurrence option checked, occurrence count starts from the end.
With Offset and Position options checked, the index of the character started from the end in the string to begin the search with.
With Offset and String options checked, the string identifies the character string from the end to begin the search with.
Copyright © AgileLoad. All rights reserved.