diff --git a/docs/tools/dump_ast_matchers.py b/docs/tools/dump_ast_matchers.py
index ccbb616d7b5644b0556aa6d4c4783489db6db907..c2fdcc2883408c3f0706965060102eb826d2bac5 100644
--- a/docs/tools/dump_ast_matchers.py
+++ b/docs/tools/dump_ast_matchers.py
@@ -363,11 +363,11 @@ traversal_matcher_table = sort_table('TRAVERSAL', traversal_matchers)
 
 reference = open('../LibASTMatchersReference.html').read()
 reference = re.sub(r'<!-- START_DECL_MATCHERS.*END_DECL_MATCHERS -->',
-                   '%s', reference, flags=re.S) % node_matcher_table
+                   node_matcher_table, reference, flags=re.S)
 reference = re.sub(r'<!-- START_NARROWING_MATCHERS.*END_NARROWING_MATCHERS -->',
-                   '%s', reference, flags=re.S) % narrowing_matcher_table
+                   narrowing_matcher_table, reference, flags=re.S)
 reference = re.sub(r'<!-- START_TRAVERSAL_MATCHERS.*END_TRAVERSAL_MATCHERS -->',
-                   '%s', reference, flags=re.S) % traversal_matcher_table
+                   traversal_matcher_table, reference, flags=re.S)
 
 with open('../LibASTMatchersReference.html', 'wb') as output:
   output.write(reference)