I need to convert IP address into a regex expression in shell script.
Example Scenario: User will give the below as Input's, min Ip address value - 102.0.0.0 max Ip address value - 102.255.255.254
I am trying to generate the below regex as o/p to user using shell script.
Generated Regex: ^102.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5])).(([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-4])).([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))|255.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-4])))$
Note: Please note in most of the searches they have provided scripts to check if an IP address is valid or not. But my question is specifically intended to convert an IP address to regex using shell scripting.