diff --git a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/StylesCombo.php b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/StylesCombo.php
index 2f14bca..e6e8b03 100644
--- a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/StylesCombo.php
+++ b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/StylesCombo.php
@@ -140,7 +140,7 @@ protected function generateStylesSetSetting($styles) {
       }
 
       // Validate syntax: element[.class...]|label pattern expected.
-      if (!preg_match('@^ *[a-zA-Z0-9]+ *(\\.[a-zA-Z0-9_-]+ *)*\\| *.+ *$@', $style)) {
+      if (!preg_match('@^ *[a-zA-Z0-9-]+ *(\\.[a-zA-Z0-9_-]+ *)*\\| *.+ *$@', $style)) {
         return FALSE;
       }
 
diff --git a/core/modules/ckeditor/tests/modules/src/Kernel/CKEditorTest.php b/core/modules/ckeditor/tests/modules/src/Kernel/CKEditorTest.php
index 4f1da31..72d4077 100644
--- a/core/modules/ckeditor/tests/modules/src/Kernel/CKEditorTest.php
+++ b/core/modules/ckeditor/tests/modules/src/Kernel/CKEditorTest.php
@@ -353,6 +353,13 @@ public function testStylesComboGetConfig() {
     $expected['stylesSet'] = [['name' => 'Title', 'element' => 'h1']];
     $this->assertIdentical($expected, $stylescombo_plugin->getConfig($editor), '"StylesCombo" plugin configuration built correctly for customized toolbar.');
 
+    // Configuration that includes a dash in the class name.
+    $settings['plugins']['stylescombo']['styles'] = "      test-check |  WithDashes ";
+    $editor->setSettings($settings);
+    $editor->save();
+    $expected['stylesSet'] = [['name' => 'Title', 'element' => 'h1']];
+    $this->assertIdentical($expected, $stylescombo_plugin->getConfig($editor), '"StylesCombo" plugin configuration built correctly for customized toolbar.');
+
     // Invalid syntax should cause stylesSet to be set to FALSE.
     $settings['plugins']['stylescombo']['styles'] = "h1";
     $editor->setSettings($settings);
