diff --git a/core/modules/views/src/Plugin/views/PluginBase.php b/core/modules/views/src/Plugin/views/PluginBase.php
index 1cc52f3..ebd9a92 100644
--- a/core/modules/views/src/Plugin/views/PluginBase.php
+++ b/core/modules/views/src/Plugin/views/PluginBase.php
@@ -374,7 +374,8 @@ protected function viewsTokenReplace($text, $tokens) {
         assert('preg_match(\'/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/\', $top) === 1', 'Tokens need to be valid Twig variables.');
         $token_array = array(array_pop($parts) => $replacement);
         foreach(array_reverse($parts) as $key) {
-          assert('preg_match(\'/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/\', $key) === 1', 'Tokens need to be valid Twig variables.');
+          // The key could also be numeric (array index) so allow that.
+          assert('is_numeric($key) || (preg_match(\'/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/\', $key) === 1)', 'Tokens need to be valid Twig variables.');
           $token_array = array($key => $token_array);
         }
         if (!isset($twig_tokens[$top])) {
diff --git a/core/modules/views/src/Tests/Plugin/PluginBaseTest.php b/core/modules/views/src/Tests/Plugin/PluginBaseTest.php
index 4161db4..cca52cc 100644
--- a/core/modules/views/src/Tests/Plugin/PluginBaseTest.php
+++ b/core/modules/views/src/Tests/Plugin/PluginBaseTest.php
@@ -55,6 +55,16 @@ public function testViewsTokenReplaceWithDots() {
     });
 
     $this->assertIdentical($result, 'first comes before second');
+
+    // Test tokens with numeric indexes.
+    $text = '{{ argument.0.first }} comes before {{ argument.1.second }}';
+    $tokens = ['{{ argument.0.first }}' => 'first', '{{ argument.1.second }}' => 'second'];
+
+    $result = \Drupal::service('renderer')->executeInRenderContext(new RenderContext(), function () use ($text, $tokens) {
+      return $this->testPluginBase->viewsTokenReplace($text, $tokens);
+    });
+
+    $this->assertIdentical($result, 'first comes before second');
   }
 
   /**
