p = re.compile('Dhcp Server .*? add scope .*? (.*?) ')
test_str = 'Dhcp Server \\server1 add scope 10.0.1.0 255.255.255.0 "area1"'
subst = "255.255.254.0"
re.sub(p, subst, test_str)
The output is 255.255.254.0. What i am trying to get is this:
Dhcp Server \\server1 add scope 10.0.1.0 255.255.254.0 "area1"'
I can't simply use string replace because server1 and 10.0.1.0 will by dynamic.
How can I get my desired result when using Python 3.5? I looked at other SO questions, but did not find one quite like my question.