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

how to access RegEx ouput of two IP addresses?

Use case:

1.      'sh ip cache flow | I K' command on a router returns output as shown in attachment named screen shot 1.

2.      I have a regular expression to match for IP addresses. The output of this regular expression match is shown in attachment named screen shot 2. The match correctly returns two IP addresses, one is the source address (10.0.12.1) and the other is the destination address (10.0.12.2) in the actual network.

3.      In attachment named screen shot 3, I am mapping the source address of 10.0.12.1 (using ‘First Match’) to a variable called ‘Source IP Address’ of type string.

4.      As you can see in screen shot 3, there is no way for me to access the next matching address (which is 10.0.12.2) as there is nothing like ‘Next Match’ [or] ‘Last Match’ available to set the destination address variable. ‘All Matches’ option also shows greyed out in screen shot 3.

Question: How to get to the second address of 10.0.12.2 which is shown as regex match output in screen shot 2?

Thanks.

1 Reply 1

Shaun Roberts
Cisco Employee
Cisco Employee

All matches is an array. You would have to for-each through it.

--Shaun Roberts
Principal Engineer, CX
shaurobe@cisco.com