Joshua5699
8/20/2014 - 9:52 PM

Return an array of all Guids from text

Return an array of all Guids from text

        public List<String> FindGuids(string Text)
        {
            List<String> Guids = new List<String>();
            string Pattern = "[a-fA-F0-9]{8}-([a-fA-F0-9]{4}-){3}[a-fA-F0-9]{12}";
            foreach (Match m in Regex.Matches(Text, Pattern))
            {
                if (m.Value.Contains("{"))
                {
                    Guids.Add(m.Value);
                }
                else {
                    Guids.Add("{"+m.Value+"}");
                }
                
            }
            return Guids;
        }