Browse Source

Simplify identifier regex inside SectionPairSectionValidator class

Patrick-Christopher Mattulat 1 year ago
parent
commit
f81c82152c

+ 4 - 2
source/ls-std/io/section-pair/validator/SectionPairSectionValidator.cpp

@@ -3,10 +3,11 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-20
-* Changed:         2023-02-20
+* Changed:         2023-02-21
 *
 * */
 
+#include <ls-std/io/section-pair/validator/SectionPairIdentifierValidator.hpp>
 #include <ls-std/io/section-pair/validator/SectionPairRowValidator.hpp>
 #include <ls-std/io/section-pair/validator/SectionPairSectionValidator.hpp>
 #include <regex>
@@ -33,7 +34,8 @@ bool ls::std::io::SectionPairSectionValidator::isValid()
 ::std::string ls::std::io::SectionPairSectionValidator::_getValidationRegex()
 {
   ::std::string newLine = R"(((\n)|(\r\n)))";
-  ::std::string sectionHeader = newLine + R"(\[{1}([a-z]([a-z0-9-]){1,15})\]{1}()" + newLine + R"({2}))";
+  ::std::string identifier = ls::std::io::SectionPairIdentifierValidator::getValidationRegex();
+  ::std::string sectionHeader = newLine + R"(\[{1}()" + identifier + R"()\]{1}()" + newLine + R"({2}))";
   ::std::string row = ls::std::io::SectionPairRowValidator::getValidationRegex();
   ::std::string atLeastOneRow = R"((()" + row + R"(){1}))";
   ::std::string optionalRows = R"((()" + row + R"()*))";