diff --git a/extensions/markdown/syntaxes/markdown.tmLanguage b/extensions/markdown/syntaxes/markdown.tmLanguage
index da80a9e0bd8..d2f86783846 100644
--- a/extensions/markdown/syntaxes/markdown.tmLanguage
+++ b/extensions/markdown/syntaxes/markdown.tmLanguage
@@ -476,7 +476,7 @@
while
- \G([ ]{4}|\t|$)
+ (^|\G)([ ]{4}|\t)
begin
@@ -503,7 +503,7 @@
while
- \G([ ]{4}|\t|$)
+ (^|\G)([ ]{4}|\t)