The solution I provided is nice in terms of being short and to the point, but regular expressions are not intuitive and come with a steep learning curve.
Here’s another (regular expression-free) solution that will likely help you solve problems like this a little more easily on your own as you do more with PowerShell:
# Start with an IP address
$ipAddress = '10.20.30.41'
# Now lets split the address into its parts by using the dot ('.')
$ipAddressParts = $ipAddress.Split('.')
# Now reverse the array in place
# For the zone, we only care about the first 2 and last 1 part of the ip address, so lets get those
$importantIpAddressParts = $ipAddressParts | Select-Object -First 2 -Last 1
# Now that we have those parts, lets join them with '.' and add the zone suffix
$zone = [string]::Join('.',$importantIpAddressParts) + '.in-addr.arpa'
# Now output the zone
This is a good example that shows the power of regular expressions though, because what I do here in many lines of script I can accomplish in a single line with a regular expression like I did earlier. Granted, I could have made this approach shorter by combining some of the steps, but I wanted to flush it out so that you could see what is being done each step of the way.