internal string CreateRegexPatternForUnit <TUnitType>( TUnitType unit, IFormatProvider formatProvider, bool matchEntireString = true) where TUnitType : Enum { var unitAbbreviations = _unitAbbreviationsCache.GetUnitAbbreviations(unit, formatProvider); var pattern = GetRegexPatternForUnitAbbreviations(unitAbbreviations); return(matchEntireString ? $"^{pattern}$" : pattern); }