The task. We have a text with GUIDs and we want to get all the GUIDs.

Tools. We'll use Regular Expressions in C# for this task.

Solution. The most important in this code is @"\b[A-F0-9]{8}(?:-[A-F0-9]{4}){3}-[A-F0-9]{12}\b

            string users = ";#5372B824-EC72-492E-9F54-12109DD350D5;#user1;#3B6B6568-D241-4A7A-934F-9FA62EA038DA;#user2;";

            MatchCollection ugs = Regex.Matches(users, @"\b[A-F0-9]{8}(?:-[A-F0-9]{4}){3}-[A-F0-9]{12}\b", RegexOptions.IgnoreCase);

            if (ugs.Count > 0)
            {
                foreach (Match ug in ugs)
                {
                    Console.WriteLine(ug.Value);
                }

            }