tagparameter(
tagparameter(
TEXT
,
TAG
,
ITEM
)

The tagparameter( function extracts the value of a tag parameter embedded in some text, where the tag parameter takes the form name=value.

Parameters

This function has three parameters:

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

tag – is the name of the tag parameter you want to extract, including the trailing = sign (you may use other terminators, for example colons (`font:Helvetica`) or period (`font.Helvetica`). For example, if you want to extract the font name from the text `font=Helvetica size=12` the tag would be `font=`.

item – is the number of the parameter you want to extract. This is usually 1, but may be other values if you expect multiple instances of the parameter (multiple fonts, for example). It will default to one if this parameter is omitted.

Description

The tagparameter( function extracts the value of a tag parameter embedded in some text, where each tag parameter takes the form name=value. This function returns the contents (text) of the specified parameter. If the parameter is surrounded by quotes, the quotes are removed. (Quotes are necessary if the parameter value contains spaces, for example `font="Times Roman"`. Allowed quote characters include double quotes (`"`), single quotes (`'`), single and double smart quotes (`“” ‘’`), curly brackets (`{}`) and multiple pipe characters (|).

This example very quickly builds a list of all the GIF and JPEG images displayed in the page HTMLPage.

    local imageTags,imageNames
    imageTag=tagarray(HTMLPage,"<IMG",">",cr())
    arrayfilter imageTag,imageNames,cr(),tagparameter( import(), "src=",1)

See Also

- gettaglocation -- locates the first matching tag within some text.
- gettaglocations -- locates all matching tags within some text.
- settagdata -- changes the contents of a tag.
- setxtagvalue -- changes the contents of a tag.
- tagarray( -- builds an array (see Text Arrays) containing the body of all the specified tags (usually HTML tags) in the text.
- tagcount( -- counts the number of times a specified tag (usually an HTML tag) appears in the text. See Tag Parsing for more information on HTML tags.
- tagdata( -- extracts the body of the specified tag (usually an HTML tag) in the text. See Tag Parsing for more information on HTML tags.
- tagend( -- returns the ending position of the specified tag (usually an HTML tag) in the text.
- tagnumber( -- checks to see if a specified position is inside of a tag (usually an HTML tag).
- tagstart( -- returns the starting position of the specified tag (usually an HTML tag) in the text.
- tagstrip( -- removes tags (usually HTML tags) from within a piece of text.
- xtag( -- generates an HTML/XML tag.
- xtagvalue( -- extracts the text from the first matching HTML or XML tag.

History

Version | Status | Notes
10.0 | Updated | Carried over from Panorama 6.0, but now allows the item parameter to be omitted (it will default to 1).