Cisco Active Network Abstraction Customization User Guide, 3.6.4
Parsing Operators/Rules

Table Of Contents

Parsing Operators/Rules

Header and Footer

Description

Dialog Box

Parameters

Remove Lines

Description

Dialog Box

Parameters

Select Lines

Description

Dialog Box

Parameters

Replace

Description

Dialog Box

Parameters

Match

Description

Dialog Box

Parameters

Set

Description

Dialog Box

Parameters

Substring

Description

Dialog Box

Parameters

Parse Integer

Description

Dialog Box

Parameters


Parsing Operators/Rules


This chapter describes the predefined text manipulation operators available for parsing raw device input and turning each into a soft property that is available in the Add/Edit Parsing Rule dialog box. The chapter includes the name, description, expected input, validation rules, and any unique fields displayed in the dialog box for each operator and provides an example, as well.

This chapter includes the following sections:

Header and Footer

Remove Lines

Select Lines

Replace

Match

Set

Substring

Parse Integer

For more information about the Add/Edit Parsing Rule dialog box, see Defining the Parsing Parameters, page 3-9.

Header and Footer

Description

Removes a specified number of lines from the header and footer of the input text.

Dialog Box

Figure 5-1 shows the Add/Edit Parsing Rule dialog box that is displayed when the Header And Footer operator is selected. In addition, the dialog box displays an example using the Header And Footer operator.

Figure 5-1 Header and Footer Operator

Parameters

Parameter
Description
Validation Rule

Header lines

The number of header lines to be removed.

Integers only. Mandatory.

Footer lines

The number of footer lines to be removed.

Integers only. Mandatory.


Remove Lines

Description

Removes a range of lines from the specified starting row to the specified end row of the input text.

Dialog Box

Figure 5-2 shows the Add/Edit Parsing Rule dialog box that is displayed when the Remove Lines operator is selected. In addition, the dialog box displays an example using the Remove Lines operator.

Figure 5-2 Remove Lines Operator

Parameters

Parameter
Description
Validation Rule

From line

Index of first row to begin removal, inclusive.

Integer only. Mandatory.

To line

Index of last row to be removed, inclusive.

Integer only. Equal to or greater than From line. Mandatory.


Select Lines

Description

Extracts a range of lines from the specified starting row to the specified end row of the input text.

Dialog Box

Figure 5-3 shows the Add/Edit Parsing Rule dialog box that is displayed when the Select Lines operator is selected. In addition, the dialog box displays an example using the Select Lines operator.

Figure 5-3 Select Lines Operator

Parameters

Parameter
Description
Validation Rule

From line

Index of first row to begin selection, inclusive.

Integer only. Mandatory.

To line

Index of last row to be selected, inclusive.

Integer only. Equal to or greater than From line. Mandatory.


Replace

Description

Finds one substring or all occurrences of a substring that matches a specified regular expression, and replaces it with a specified value.

Dialog Box

Figure 5-4 shows the Add/Edit Parsing Rule dialog box that is displayed when the Replace operator is selected. In addition, the dialog box displays an example using the Replace operator.

Figure 5-4 Replace Operator

Parameters

Parameter
Description
Validation Rule

Expression

Search for value or regular expression.

Text. Mandatory.

With

Replace string with value or regular expression.

Text. Mandatory.

From Index

Starting index.

Integer. Mandatory.

Note The value entered in this field must be 1 or higher.

Replace All

Check box. Select this option to replace all occurrences of the matching substrings, otherwise only the first instance is replaced.

Default is unchecked.


Match

Description

Finds and extracts a substring that matches a specified regular expression. If no match can be found, the output buffer receives an empty string.

Dialog Box

Figure 5-5 shows the Add/Edit Parsing Rule dialog box that is displayed when the Match operator is selected. In addition, the dialog box displays an example using the Match operator.

Figure 5-5 Match Operator

Parameters

Parameter
Description
Validation Rule

Expression

Search for value or regular expression.

Text. Mandatory.


Set

Description

Prints the results of the input and output buffers.

Dialog Box

Figure 5-6 shows the Add/Edit Parsing Rule dialog box that is displayed when the Set operator is selected. In addition, the dialog box displays an example using the Set operator.

Figure 5-6 Set Operator

Parameters

Parameter
Description
Validation Rule

Expression

Regular expression template to use for formatting. $_$ specifies the main output buffer.

Text. Mandatory.


Substring

Description

Extracts a substring of a specified length from a specified starting point.

Dialog Box

Figure 5-7 shows the Add/Edit Parsing Rule dialog box that is displayed when the Substring operator is selected. In addition, the dialog box displays an example using the Substring operator.

Figure 5-7 Substring Operator

Parameters

Parameter
Description
Validation Rule

From Index

Begin index to select.

Integer. Mandatory.

Note The value entered in this field must be 1 or higher.

Length

How many characters to select.

Integer. Mandatory.


Parse Integer

Description

Uses the substring rule, and when a result is received with the substring it is converted into an integer value.


Note If the substring operator contains any characters, the parsing integer operator fails.


Dialog Box

Figure 5-8 shows the Add/Edit Parsing Rule dialog box that is displayed when the Parse Integer operator is selected. In addition, the dialog box displays an example using the Parse Integer operator.

Figure 5-8 Parse Integer Operator

Parameters

Parameter
Description
Validation Rule

From Index

Starting index to select.

Integer. Mandatory.

Note The value entered in this field must be 1 or higher.

To Index

Ending index to select.

Integer. Mandatory.