diff --git a/slapos/cli/register.py b/slapos/cli/register.py
index 37ef4346efe1662da7b87881f8b3e6c2ccc7febb..18ffb43a03786d73a36dc8199c0a9fae0fdd49d2 100644
--- a/slapos/cli/register.py
+++ b/slapos/cli/register.py
@@ -279,7 +279,7 @@ def slapconfig(conf):
         to_replace.append(('ipv6_interface', conf.ipv6_interface))
 
     for key, value in to_replace:
-        cfg = re.sub('\n\s*%s\s*=.*' % key, '\n%s = %s' % (key, value), cfg)
+        cfg = re.sub('\n\\s*%s\\s*=.*' % key, '\n%s = %s' % (key, value), cfg)
 
     if not dry_run:
         with open(config_path, 'w') as fout: