Make all std::regex instances static

Per [1] we really shouldn't be using regex.  In the cases we do, it's a
HUUUUUGE performance benefit to be compiling the regex ONCE.

The only downside is a slight increase in memory usage.

[1]: https://github.com/openbmc/bmcweb/issues/176

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I8644b8a07810349fb60bfa0258a13e815912a38e
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 31a379d..330e68e 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -949,7 +949,7 @@
     // MUST handle host names of up to 63 characters (RFC 1123)
     // labels cannot start or end with hyphens (RFC 952)
     // labels can start with numbers (RFC 1123)
-    const std::regex pattern(
+    const static std::regex pattern(
         "^[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9]$");
 
     return std::regex_match(hostname, pattern);
@@ -959,7 +959,7 @@
 {
     // Can have multiple subdomains
     // Top Level Domain's min length is 2 character
-    const std::regex pattern(
+    const static std::regex pattern(
         "^([A-Za-z0-9][a-zA-Z0-9\\-]{1,61}|[a-zA-Z0-9]{1,30}\\.)*[a-zA-Z]{2,}$");
 
     return std::regex_match(domainname, pattern);