diff --git a/lib/manager/bazel/extract.js b/lib/manager/bazel/extract.js
index 0ffa2a1b77bc7b15245b97d49931b558a9640009..ef2bed64168956a6ee7d01573128b34c62e28a61 100644
--- a/lib/manager/bazel/extract.js
+++ b/lib/manager/bazel/extract.js
@@ -51,36 +51,36 @@ function extractPackageFile(content) {
     let commit;
     let url;
     let sha256;
-    let match = def.match(/name = "([^"]+)"/);
+    let match = def.match(/name\s*=\s*"([^"]+)"/);
     if (match) {
       [, depName] = match;
     }
-    match = def.match(/remote = "([^"]+)"/);
+    match = def.match(/remote\s*=\s*"([^"]+)"/);
     if (match) {
       [, remote] = match;
     }
-    match = def.match(/tag = "([^"]+)"/);
+    match = def.match(/tag\s*=\s*"([^"]+)"/);
     if (match) {
       [, currentValue] = match;
     }
-    match = def.match(/url = "([^"]+)"/);
+    match = def.match(/url\s*=\s*"([^"]+)"/);
     if (match) {
       [, url] = match;
     }
-    match = def.match(/urls = \[\s*"([^\]]+)",?\s*\]/);
+    match = def.match(/urls\s*=\s*\[\s*"([^\]]+)",?\s*\]/);
     if (match) {
       const urls = match[1].replace(/\s/g, '').split('","');
       url = urls.find(parseUrl);
     }
-    match = def.match(/commit = "([^"]+)"/);
+    match = def.match(/commit\s*=\s*"([^"]+)"/);
     if (match) {
       [, commit] = match;
     }
-    match = def.match(/sha256 = "([^"]+)"/);
+    match = def.match(/sha256\s*=\s*"([^"]+)"/);
     if (match) {
       [, sha256] = match;
     }
-    match = def.match(/importpath = "([^"]+)"/);
+    match = def.match(/importpath\s*=\s*"([^"]+)"/);
     if (match) {
       [, importpath] = match;
     }
diff --git a/lib/manager/bazel/update.js b/lib/manager/bazel/update.js
index 92afc5500903950fa93abfae9c58029b7a72b45e..325012deb6df8c24a725a1d69208f78575b60d16 100644
--- a/lib/manager/bazel/update.js
+++ b/lib/manager/bazel/update.js
@@ -14,12 +14,12 @@ async function updateDependency(fileContent, upgrade) {
       upgrade.depType === 'go_repository'
     ) {
       newDef = upgrade.def
-        .replace(/tag = "[^"]+"/, `tag = "${upgrade.newValue}"`)
-        .replace(/commit = "[^"]+"/, `commit = "${upgrade.newDigest}"`);
+        .replace(/(tag\s*=\s*)"[^"]+"/, `$1"${upgrade.newValue}"`)
+        .replace(/(commit\s*=\s*)"[^"]+"/, `$1"${upgrade.newDigest}"`);
       if (upgrade.currentDigest && upgrade.updateType !== 'digest') {
         newDef = newDef.replace(
-          /commit = "[^"]+".*?\n/,
-          `commit = "${upgrade.newDigest}",  # ${upgrade.newValue}\n`
+          /(commit\s*=\s*)"[^"]+".*?\n/,
+          `$1"${upgrade.newDigest}",  # ${upgrade.newValue}\n`
         );
       }
     } else if (upgrade.depType === 'http_archive') {
@@ -49,11 +49,13 @@ async function updateDependency(fileContent, upgrade) {
         'g'
       );
       newDef = upgrade.def.replace(valuePattern, upgrade.newValue);
-      newDef = newDef.replace(/sha256 = "[^"]+"/, `sha256 = "${hash}"`);
+      newDef = newDef.replace(/(sha256\s*=\s*)"[^"]+"/, `$1"${hash}"`);
     }
     logger.debug({ oldDef: upgrade.def, newDef });
     const existingDef = new RegExp(
-      `${upgrade.depType}\\([^\\)]+name = "${upgrade.depName}"[^\\)]+\\)\n`
+      `${upgrade.depType}\\([^\\)]+name\\s*=\\s*"${
+        upgrade.depName
+      }"[^\\)]+\\)\n`
     );
     return fileContent.replace(existingDef, newDef);
   } catch (err) {
diff --git a/test/manager/bazel/__snapshots__/extract.spec.js.snap b/test/manager/bazel/__snapshots__/extract.spec.js.snap
index 609afe3125d90f7953def89081cdf492311dbf00..da5992e2612b5948f4257583b7c03ce2ca420311 100644
--- a/test/manager/bazel/__snapshots__/extract.spec.js.snap
+++ b/test/manager/bazel/__snapshots__/extract.spec.js.snap
@@ -72,6 +72,22 @@ Array [
     "lookupName": "bazelbuild/rules_typescript",
     "remote": "https://github.com/bazelbuild/rules_typescript.git",
   },
+  Object {
+    "currentValue": "446923c3756ceeaa75888f52fcbdd48bb314fbf8",
+    "datasource": "github",
+    "def": "http_archive(
+    name=\\"distroless\\",
+    sha256=\\"f7a6ecfb8174a1dd4713ea3b21621072996ada7e8f1a69e6ae7581be137c6dd6\\",
+    strip_prefix=\\"distroless-446923c3756ceeaa75888f52fcbdd48bb314fbf8\\",
+    urls=[\\"https://github.com/GoogleContainerTools/distroless/archive/446923c3756ceeaa75888f52fcbdd48bb314fbf8.tar.gz\\"]
+)
+",
+    "depName": "distroless",
+    "depType": "http_archive",
+    "lookupName": "GoogleContainerTools/distroless",
+    "lookupType": "releases",
+    "repo": "GoogleContainerTools/distroless",
+  },
   Object {
     "currentValue": "0.0.3",
     "datasource": "github",
@@ -135,5 +151,21 @@ Array [
     "lookupType": "releases",
     "repo": "bazelbuild/bazel-skylib",
   },
+  Object {
+    "currentValue": "446923c3756ceeaa75888f52fcbdd48bb314fbf8",
+    "datasource": "github",
+    "def": "http_archive(
+    name=\\"distroless\\",
+    sha256=\\"f7a6ecfb8174a1dd4713ea3b21621072996ada7e8f1a69e6ae7581be137c6dd6\\",
+    strip_prefix=\\"distroless-446923c3756ceeaa75888f52fcbdd48bb314fbf8\\",
+    urls=[\\"https://github.com/GoogleContainerTools/distroless/archive/446923c3756ceeaa75888f52fcbdd48bb314fbf8.tar.gz\\"]
+)
+",
+    "depName": "distroless",
+    "depType": "http_archive",
+    "lookupName": "GoogleContainerTools/distroless",
+    "lookupType": "releases",
+    "repo": "GoogleContainerTools/distroless",
+  },
 ]
 `;