diff --git a/src/OSspecific/POSIX/regExp.C b/src/OSspecific/POSIX/regExp.C
index 15d0ea2ba205595ac91aa308cbe5a885311370cb..a22ba01a56330a202b409bf38ca4cb40f8fa8659 100644
--- a/src/OSspecific/POSIX/regExp.C
+++ b/src/OSspecific/POSIX/regExp.C
@@ -24,16 +24,14 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "regExp.H"
-#include "string.H"
 #include "List.H"
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template<class StringType>
 bool Foam::regExp::matchGrouping
 (
     const std::string& text,
-    List<StringType>& groups
+    List<std::string>& groups
 ) const
 {
     if (preg_ && !text.empty())
@@ -194,7 +192,7 @@ std::string::size_type Foam::regExp::find(const std::string& text) const
         }
     }
 
-    return string::npos;
+    return std::string::npos;
 }
 
 
@@ -231,28 +229,4 @@ bool Foam::regExp::match
 }
 
 
-bool Foam::regExp::match
-(
-    const std::string& text,
-    List<Foam::string>& groups
-) const
-{
-    return matchGrouping(text, groups);
-}
-
-
-// * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * * //
-
-void Foam::regExp::operator=(const char* pattern)
-{
-    set(pattern);
-}
-
-
-void Foam::regExp::operator=(const std::string& pattern)
-{
-    set(pattern);
-}
-
-
 // ************************************************************************* //
diff --git a/src/OSspecific/POSIX/regExp.H b/src/OSspecific/POSIX/regExp.H
index 03ce52b39ec6ca7eacf66e4ebcdd94eed4a20c00..76d2deba93c8128ac6652a23167af074860b6c22 100644
--- a/src/OSspecific/POSIX/regExp.H
+++ b/src/OSspecific/POSIX/regExp.H
@@ -51,7 +51,6 @@ namespace Foam
 {
 
 // Forward declaration of classes
-class string;
 template<class T> class List;
 
 
@@ -76,12 +75,10 @@ class regExp
         void operator=(const regExp&) = delete;
 
         //- Return true if it matches and sets the sub-groups matched.
-        //  Templated to support both std::string and Foam::string
-        template<class StringType>
         bool matchGrouping
         (
             const std::string&,
-            List<StringType>& groups
+            List<std::string>& groups
         ) const;
 
 
@@ -96,16 +93,7 @@ public:
         //  range: '[', ']' \n
         //
         //  Don't bother checking for '{digit}' bounds
-        inline static bool meta(const char c)
-        {
-            return
-            (
-                (c == '.')                           // any character
-             || (c == '*' || c == '+' || c == '?')   // quantifiers
-             || (c == '(' || c == ')' || c == '|')   // grouping/branching
-             || (c == '[' || c == ']')               // range
-            );
-        }
+        inline static bool meta(const char c);
 
 
     // Constructors
@@ -129,22 +117,13 @@ public:
       // Access
 
         //- Return true if a precompiled expression does not exist
-        inline bool empty() const
-        {
-            return !preg_;
-        }
+        inline bool empty() const;
 
         //- Does a precompiled expression exist?
-        inline bool exists() const
-        {
-            return preg_ ? true : false;
-        }
+        inline bool exists() const;
 
         //- The number of capture groups for a non-empty expression
-        inline unsigned ngroups() const
-        {
-            return preg_ ? preg_->re_nsub : 0;
-        }
+        inline unsigned ngroups() const;
 
 
       // Editing
@@ -173,26 +152,19 @@ public:
         //  The begin-of-line (^) and end-of-line ($) anchors are implicit
         bool match(const std::string& text, List<std::string>& groups) const;
 
-        //- Return true if it matches and sets the sub-groups matched
-        //  The begin-of-line (^) and end-of-line ($) anchors are implicit
-        bool match(const std::string& text, List<string>& groups) const;
-
         //- Return true if the regex was found within string
-        bool search(const std::string& text) const
-        {
-            return std::string::npos != find(text);
-        }
+        bool search(const std::string& text) const;
 
 
     // Member Operators
 
         //- Assign and compile pattern from a character array
         //  Always case sensitive
-        void operator=(const char* pattern);
+        inline void operator=(const char* pattern);
 
         //- Assign and compile pattern from string
         //  Always case sensitive
-        void operator=(const std::string& pattern);
+        inline void operator=(const std::string& pattern);
 };
 
 
@@ -202,6 +174,8 @@ public:
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+#include "regExpI.H"
+
 #endif
 
 // ************************************************************************* //
diff --git a/src/OSspecific/POSIX/regExpI.H b/src/OSspecific/POSIX/regExpI.H
new file mode 100644
index 0000000000000000000000000000000000000000..64865c95fa0169272806eb986090db6ecc24b253
--- /dev/null
+++ b/src/OSspecific/POSIX/regExpI.H
@@ -0,0 +1,81 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2017 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+
+// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
+
+inline bool Foam::regExp::meta(const char c)
+{
+    return
+    (
+        (c == '.')                           // any character
+     || (c == '*' || c == '+' || c == '?')   // quantifiers
+     || (c == '(' || c == ')' || c == '|')   // grouping/branching
+     || (c == '[' || c == ']')               // range
+    );
+}
+
+
+// * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
+
+inline bool Foam::regExp::empty() const
+{
+    return !preg_;
+}
+
+
+inline bool Foam::regExp::exists() const
+{
+    return preg_ ? true : false;
+}
+
+
+inline unsigned Foam::regExp::ngroups() const
+{
+    return preg_ ? preg_->re_nsub : 0;
+}
+
+
+inline bool Foam::regExp::search(const std::string& text) const
+{
+    return std::string::npos != find(text);
+}
+
+
+// * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * * //
+
+inline void Foam::regExp::operator=(const char* pattern)
+{
+    set(pattern);
+}
+
+
+inline void Foam::regExp::operator=(const std::string& pattern)
+{
+    set(pattern);
+}
+
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/lists/wordReListMatcher.H b/src/OpenFOAM/primitives/strings/lists/wordReListMatcher.H
index 2bba686964cd2c74adbc30beb81a7ff8bf990445..1f5785d3e493bd1effa133076d9804c171974107 100644
--- a/src/OpenFOAM/primitives/strings/lists/wordReListMatcher.H
+++ b/src/OpenFOAM/primitives/strings/lists/wordReListMatcher.H
@@ -68,28 +68,28 @@ public:
 
     // Member Functions
 
-        // Access
+      // Access
 
-            inline label size() const;
-            inline bool  empty() const;
+        inline label size() const;
+        inline bool  empty() const;
 
-            //- Return underlying list of wordRe
-            inline const UList<wordRe>& operator()() const;
+        //- Return underlying list of wordRe
+        inline const UList<wordRe>& operator()() const;
 
 
-        // Searching
+     // Searching
 
-            //- Return true if string matches any of the regular expressions
-            //  Smart match as regular expression or as a string.
-            //  Optionally specify a literal match only.
-            inline bool match(const string&, bool literalMatch=false) const;
+       //- Return true if string matches any of the regular expressions
+       //  Smart match as regular expression or as a string.
+       //  Optionally specify a literal match only.
+       inline bool match(const std::string&, bool literalMatch=false) const;
 
 
-        // Helpers
+     // Helpers
 
-            //- Return a wordReList with duplicate words filtered out.
-            //  No filtering is done on regular expressions.
-            static wordReList uniq(const UList<wordRe>& input);
+       //- Return a wordReList with duplicate words filtered out.
+       //  No filtering is done on regular expressions.
+       static wordReList uniq(const UList<wordRe>& input);
 
 };
 
diff --git a/src/OpenFOAM/primitives/strings/lists/wordReListMatcherI.H b/src/OpenFOAM/primitives/strings/lists/wordReListMatcherI.H
index 9c484297df7d939992d8761af6aa00845ac2b36b..d4b3c7dce23f9747d68055548187e2b10c8910f3 100644
--- a/src/OpenFOAM/primitives/strings/lists/wordReListMatcherI.H
+++ b/src/OpenFOAM/primitives/strings/lists/wordReListMatcherI.H
@@ -58,14 +58,14 @@ Foam::wordReListMatcher::operator()() const
 
 inline bool Foam::wordReListMatcher::match
 (
-    const string& str,
+    const std::string& text,
     bool literalMatch
 ) const
 {
-    const label nElem = reList_.size();
-    for (label elemI = 0; elemI < nElem; ++elemI)
+    const label n = reList_.size();
+    for (label i = 0; i < n; ++i)
     {
-        if (reList_[elemI].match(str, literalMatch))
+        if (reList_[i].match(text, literalMatch))
         {
             return true;
         }
diff --git a/src/OpenFOAM/primitives/strings/string/string.H b/src/OpenFOAM/primitives/strings/string/string.H
index 7010427059effe434f7dd4f30494ef5c286c4915..b1129c7c3a6519e7ab3dd37bdab7279afc84b01f 100644
--- a/src/OpenFOAM/primitives/strings/string/string.H
+++ b/src/OpenFOAM/primitives/strings/string/string.H
@@ -63,9 +63,9 @@ class Ostream;
 
 // Forward declaration of friend functions and operators
 class string;
-Istream& operator>>(Istream&, string&);
-Ostream& operator<<(Ostream&, const string&);
-Ostream& operator<<(Ostream&, const std::string&);
+Istream& operator>>(Istream& is, string& s);
+Ostream& operator<<(Ostream& os, const string& s);
+Ostream& operator<<(Ostream& os, const std::string& s);
 
 
 /*---------------------------------------------------------------------------*\
@@ -124,33 +124,33 @@ public:
         //- Count and return the number of a given character in the string
         size_type count(const char c) const;
 
-        //- Is this string type valid?
+        //- Does the string contain valid characters only?
         template<class String>
-        static inline bool valid(const string& str);
+        static inline bool valid(const std::string& str);
 
-        //- Does this string have particular meta-characters?
+        //- Does this string contain meta-characters?
         //  The meta characters can be optionally quoted.
         template<class String>
-        static inline bool meta(const string& str, const char quote = '\\');
+        static inline bool meta(const std::string& str, const char quote='\\');
 
         //- Strip invalid characters from the given string
         template<class String>
-        static inline bool stripInvalid(string& str);
+        static inline bool stripInvalid(std::string& str);
 
         //- Return a valid String from the given string
         template<class String>
-        static inline String validate(const string& str);
+        static inline String validate(const std::string& str);
 
         //- Return a String with quoted meta-characters from the given string
         template<class String>
         static inline string quotemeta
         (
-            const string& str,
+            const std::string& str,
             const char quote = '\\'
         );
 
         //- True when strings match literally
-        inline bool match(const std::string& str) const;
+        inline bool match(const std::string& text) const;
 
         //- Avoid masking the normal std::string replace
         using std::string::replace;
diff --git a/src/OpenFOAM/primitives/strings/string/stringI.H b/src/OpenFOAM/primitives/strings/string/stringI.H
index 3dc2fe043fa87f792b31f1bb9f6533cbde1e6b1b..ccd5d29616e1baee69ef287a8b9b0785f0925377 100644
--- a/src/OpenFOAM/primitives/strings/string/stringI.H
+++ b/src/OpenFOAM/primitives/strings/string/stringI.H
@@ -61,7 +61,7 @@ inline Foam::string::string(const char c)
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class String>
-inline bool Foam::string::valid(const string& str)
+inline bool Foam::string::valid(const std::string& str)
 {
     for (const_iterator iter = str.begin(); iter != str.end(); ++iter)
     {
@@ -75,7 +75,7 @@ inline bool Foam::string::valid(const string& str)
 
 
 template<class String>
-inline bool Foam::string::stripInvalid(string& str)
+inline bool Foam::string::stripInvalid(std::string& str)
 {
     if (!valid<String>(str))
     {
@@ -85,11 +85,11 @@ inline bool Foam::string::stripInvalid(string& str)
         for
         (
             const_iterator iter1 = iter2;
-            iter1 != const_cast<const string&>(str).end();
+            iter1 != const_cast<const std::string&>(str).end();
             iter1++
         )
         {
-            char c = *iter1;
+            const char c = *iter1;
 
             if (String::valid(c))
             {
@@ -109,20 +109,21 @@ inline bool Foam::string::stripInvalid(string& str)
 
 
 template<class String>
-inline bool Foam::string::meta(const string& str, const char quote)
+inline bool Foam::string::meta(const std::string& str, const char quote)
 {
     int escaped = 0;
     for (const_iterator iter = str.begin(); iter != str.end(); ++iter)
     {
-        if (quote && *iter == quote)
+        const char c = *iter;
+        if (quote && c == quote)
         {
             escaped ^= 1;  // toggle state
         }
         else if (escaped)
         {
-            escaped = false;
+            escaped = 0;
         }
-        else if (String::meta(*iter))
+        else if (String::meta(c))
         {
             return true;
         }
@@ -133,7 +134,7 @@ inline bool Foam::string::meta(const string& str, const char quote)
 
 template<class String>
 inline Foam::string
-Foam::string::quotemeta(const string& str, const char quote)
+Foam::string::quotemeta(const std::string& str, const char quote)
 {
     if (!quote)
     {
@@ -146,7 +147,8 @@ Foam::string::quotemeta(const string& str, const char quote)
     int escaped = 0;
     for (const_iterator iter = str.begin(); iter != str.end(); ++iter)
     {
-        if (*iter == quote)
+        const char c = *iter;
+        if (c == quote)
         {
             escaped ^= 1;  // toggle state
         }
@@ -154,12 +156,12 @@ Foam::string::quotemeta(const string& str, const char quote)
         {
             escaped = 0;
         }
-        else if (String::meta(*iter))
+        else if (String::meta(c))
         {
             sQuoted += quote;
         }
 
-        sQuoted += *iter;
+        sQuoted += c;
     }
 
     sQuoted.resize(sQuoted.length());
@@ -169,17 +171,17 @@ Foam::string::quotemeta(const string& str, const char quote)
 
 
 template<class String>
-inline String Foam::string::validate(const string& str)
+inline String Foam::string::validate(const std::string& str)
 {
     string ss = str;
     stripInvalid<String>(ss);
     return ss;
 }
 
-inline bool Foam::string::match(const std::string& str) const
+inline bool Foam::string::match(const std::string& text) const
 {
     // check as string
-    return (str == *this);
+    return (text == *this);
 }
 
 
diff --git a/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormatCore.C b/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormatCore.C
index 1894f293af4f2e887425125f7df3d5b4568ec9f2..b926f96802d0510054cc5287c773dda39a0b87c4 100644
--- a/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormatCore.C
+++ b/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormatCore.C
@@ -58,7 +58,7 @@ Foam::fileFormats::STARCDsurfaceFormatCore::readInpCellTable
     );
 
     string line;
-    List<string> groups;
+    List<std::string> groups;
     while (is.good() && is.getLine(line).good())
     {
         if (ctnameRE.match(line, groups))