cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
124
Views
0
Helpful
0
Replies

Extracting the last word in a string within an NSO template

ryahoffman
Level 1
Level 1

Need to extract the last word from a device interface description below in my Cisco NSO XML template.

ncs(config)# xpath eval /oc-if-config:oc-interfaces//device[device='se1']/interfaces/interface[name='1/1/c1/1']/config/description
/oc-if-config:oc-interfaces//device[device='se1']/interfaces/interface[name='1/1/c1/1']/config/description :: to sx1
ncs(config)#

Line I'd like to construct in my XML template (replacing substring-after-last with a supported function):

<?set LAST_WORD={substring-after-last(config/description, ' ')} ?>

For the above description string "to sx1" I need it to extract "sx1".  This last word could be of any length, and there could be any number of space-delimited words in the description.
Does a Cisco NSO template support a regular expression or similar function to achieve this?



0 Replies 0