tagarray(
THETEXT
,
HEADER
,
TRAILER
,
SEPARATOR
)

The tagarray( function builds an array (see Text Arrays) containing the body of all the specified tags (usually HTML tags) in the text.


Parameters

This function has four parameters:

thetext – is the item of text that contains the data you want to extract.

header – is the text that you want to use as a tag header. For example, if you want to extract all HTML tags, use "<" as the header. If you wanted to extract all bold text you would use "<B>" as the header. (Note: Upper or lower case is ignored, so "<b>" will also work.)

trailer – is the text that you want to use as a tag trailer. For example, if you want to extract all HTML tags, use ">" as the trailer. If you wanted to extract all bold text you would use "</B>" as the trailer. (Note: Upper or lower case is ignored, so "</b>" will also work.)

separator – is the separator character for the output array.


Description

This function returns an array that contains the contents of every specified tag, one tag per array item. The headers and trailers themselves are not included as part of each array item.

This example assumes you have a field or variable named myPage that contains an HTML page. The example will find and list all of the HTML tags in the page.

local myTags
myTags=tagarray(myPage,"<",">",";")
arrayfilter myTags,myTags,";",?( import() notmatch "/*",import(),"")
arraydeduplicate myTags,myTags,";"
message myTags

The output from this example will be something like this (any tags starting with / have been removed by the arrayfilter statement):

*B,BODY,CENTER,FONT,HTML,TITLE*

The more useful example below displays all of the links from this page to any other page.

message tagarray(myPage,{href="},{"},¶)

See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0