[python]Convert show ip int brief into structured json data

Cisco IOS commands output is unstructured in the perception of scripting, the output format made sense only to engineers, however if you need to program such output is difficult if the output is not processed. One of the better way to structure the unstructured cisco output is to check each row of the output, then … Continue reading [python]Convert show ip int brief into structured json data

[python]Regex for matching ipv4 address

The regex pattern to match valid ipv4 addressing, which will include broadcast address, and also network id and direct broadcast address. First octet, to be valid: 1. 25[0-5] matches between 250 and 255. 2. 2[0-4][0-9] matches between 200 and 249. 3. 1[0-9][0-9] matches between 100 and 199. 4. [1-9][0-9] matches between 10 and 99. 5. … Continue reading [python]Regex for matching ipv4 address

[python]Modification of the regex code

This is a modification of the code I posted previously for regex practice. I change the from split() to splitlines(), splitlines() will split which row of the string only when the end of string is detected hence will preserve the string that has whitespaces in between on each row. So here's the example: notice the … Continue reading [python]Modification of the regex code