diff --git a/src/Umbraco.Core/StringExtensions.cs b/src/Umbraco.Core/StringExtensions.cs
index b92df5f1cf..766e038588 100644
--- a/src/Umbraco.Core/StringExtensions.cs
+++ b/src/Umbraco.Core/StringExtensions.cs
@@ -666,31 +666,12 @@ namespace Umbraco.Core
return compare.Contains(compareTo, StringComparer.InvariantCultureIgnoreCase);
}
- ///
- /// Determines if the string is a Guid
- ///
- ///
- ///
- ///
+ [Obsolete("Use Guid.TryParse instead")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
public static bool IsGuid(this string str, bool withHyphens)
{
- var isGuid = false;
-
- if (!String.IsNullOrEmpty(str))
- {
- Regex guidRegEx;
- if (withHyphens)
- {
- guidRegEx = new Regex(@"^(\{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\}{0,1})$");
- }
- else
- {
- guidRegEx = new Regex(@"^(\{{0,1}([0-9a-fA-F]){8}([0-9a-fA-F]){4}([0-9a-fA-F]){4}([0-9a-fA-F]){4}([0-9a-fA-F]){12}\}{0,1})$");
- }
- isGuid = guidRegEx.IsMatch(str);
- }
-
- return isGuid;
+ Guid g;
+ return Guid.TryParse(str, out g);
}
///
@@ -712,7 +693,7 @@ namespace Umbraco.Core
///
public static object ParseInto(this string val, Type type)
{
- if (!String.IsNullOrEmpty(val))
+ if (string.IsNullOrEmpty(val) == false)
{
TypeConverter tc = TypeDescriptor.GetConverter(type);
return tc.ConvertFrom(val);