A PowerShell script that will provide you the Regex syntax for matching an IP range
To use this script:
To get regex syntax for a Single IP:
.\IPrangeRegex.ps1 -IPRange 192.168.10.1
To get regex syntax for a range in format startrange-endrange
.\IPrangeRegex.ps1 -IPRange 192.168.10.0-192.168.10.255
To get Regex syntax for a range in CIDR Format
.\IPrangeRegex.ps1 -IPRange 192.168.10.0/21
Note: Subnet masks < 19 may take some time to calculate.