I have a list containing the data of a command. There is always 3 elements in this list :
> print (command)
['ip1', 'mac1', 'name1']
Sometime the 3rd element expand because the name of the equipment is using multiple word.
> print (command[2]) # name 1
Desk
or
> print (command[2]) # name 1
Living Room
But it can also expand because it containing another result :
> print (command)
['ip1', 'mac1', 'name 1 ip2 mac2 name2']
When i split the third element by blank space, the position of ip2 and mac2 in the new list can change :
> array = command[2].split()
> print (array)
['Desk', '192.168.1.2', 'aa:bb:cc:01:02:03', 'Kitchen']
['Living', 'Room', '192.168.1.10', 'dd:ee:ff:77:88:99', 'Kitchen']
I would like to get ip2 and mac2 from the third element, but i dont know how to search / recognise a string pattern. In bash i would use '#' to replace the changing characters of the adresses and try to match with a if, while i loop through the new list. But in python i can't do #.#.#.# for the ip and the address.