25 constexpr
char spaceRegex[] = R
"(\s)";
26 constexpr char startAnchorRegex[] = R
"(^)";
27 constexpr char endAnchorRegex[] = R
"(\s?$)";
28 constexpr char optionalSpaceRegex[] = R
"(\s?)";
30 constexpr char charRegex[] = R
"((.))";
31 constexpr char size_tRegex[] = R
"((\d+?))";
32 constexpr char emptyWordRegex[] = R
"((.*?))";
33 constexpr char wordRegex[] = R
"((.+?))";
34 constexpr char optionalCharRegex[] = R
"((?:\s(.))?)";
35 constexpr char optionalWordRegex[] = R
"((?:\s(.+?))?)";
36 constexpr char optionalSize_tRegex[] = R
"((?:\s(\d+?))?)";
38 std::string built( "" );
41 built += startAnchorRegex;
44 built += indentifier + emptyWordRegex;
47 for (
char letter : simplifiedMatching ) {
51 built += optionalSize_tRegex;
59 built += optionalWordRegex;
67 built += optionalCharRegex;
75 built += optionalSpaceRegex;
91 built += endAnchorRegex;
94 return std::regex( built.c_str() );
std::regex generateRegex(std::string indentifier, std::string simplifiedMatching, bool startAnchor, bool endAnchor)
a helper function to aid in the construction of regexes for parsing netlist files