XPath and Regular Expression Examples
Default Xpath and Regex are added during server start up or data migration performed during an upgrade. These default Xpath and Regex are added only on the initial server start up and during data migration as a result of an upgrade.The User can perform all the usual operations on the default Xpath and Regex, including delete operation.
Adding default Xpath and Regex during migration has the following conditions:
13.1 to 13.3:
Default Xpath and Regex are added if an entity with the same name does not exist in 13.1.
Default Xpath and Regex are over written if an entity with the same name exists in 13.1.
13.3 to later releases:
Default Xpath and Regex are not added/overwritten, if the default Xpath and Regex is modified/deleted by the user in 13.3.
Example 1 – Alphanumeric
To refer in configlet’s Regex Value. It accepts all the alphanumeric characters.
Type: Regular Expression
Value: [a-zA-Z0-9]*
Example 2 - Logical Interfaces per Physical Interface
To fetch the logical interface of selected physical interface
Type: Xpath Context
Value: /device/configuration/interfaces/interface[name="$INTERFACE.get(0)"]/unit/name/text()
Example 3 – Physical Interfaces
To fetch the name of the physical interface
Type: Xpath Context
Value: /device/interface-information/physical-interface/name/text()
Example 4 – Devices
To fetch the name of the selected device
Type: Xpath Context
Value: /device/name/text()