diff --git a/core/modules/action/src/ActionFormBase.php b/core/modules/action/src/ActionFormBase.php
index 0b972d4..5cafae6 100644
--- a/core/modules/action/src/ActionFormBase.php
+++ b/core/modules/action/src/ActionFormBase.php
@@ -56,7 +56,10 @@ public static function create(ContainerInterface $container) {
    */
   public function buildForm(array $form, FormStateInterface $form_state) {
     $this->plugin = $this->entity->getPlugin();
-    return parent::buildForm($form, $form_state);
+    $form = parent::buildForm($form, $form_state);
+    $form['id']['#machine_name']['replace_pattern'] = '[^a-z0-9_.]+';
+    $form['id']['#machine_name']['error'] = t('The machine-readable name must contain only lowercase letters, numbers, periods, and underscores.');
+    return $form;
   }
 
   /**
