Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8144233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:19:23+00:00 2026-06-06T13:19:23+00:00

I am looking for a way to find a Guid within a string that

  • 0

I am looking for a way to find a Guid within a string that is in a .NET recognizable pattern.

There are a few regex’s available in this popular library, but I can’t find one that works for all of the possible Guids outlined here in this MSDN article.

For example, lets say I have a string like this:

ACTIVITY: “{0xCA761232, 0xED42, 0x11CE, {0xBA, 0xCD, 0x00, 0xAA, 0x00, 0x57, 0xB2, 0x23}}”, Time:09:09:09:09

This should return:

{0xCA761232, 0xED42, 0x11CE, {0xBA, 0xCD, 0x00, 0xAA, 0x00, 0x57, 0xB2, 0x23}}

Another example could be:

Random string CA761232-ED42-11CE-BACD-00AA0057B223 random string

This should return:

CA761232-ED42-11CE-BACD-00AA0057B223

Any ideas on how to approach this? Is regular expressions the way to go here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:19:25+00:00Added an answer on June 6, 2026 at 1:19 pm

    Solution is:

    using System;
    using System.Text.RegularExpressions;
    
    class Program
    {
      static void Main()
      {
        string input = "Random string CA761232-ED42-11CE-BACD-00AA0057B223 random string";
        Match match = Regex.Match(input,
          @"((?:(?:\s*\{*\s*(?:0x[\dA-F]+)\}*\,?)+)|(?<![a-f\d])[a-f\d]{32}(?![a-f\d])|" +
          @"(?:\{\(|)(?<![A-F\d])[A-F\d]{8}(?:\-[A-F\d]{4}){3}\-[A-F\d]{12}(?![A-F\d])(?:\}|\)|))");
        if (match.Success)
        {
          string key = match.Groups[1].Value;
          Console.WriteLine(key);
        }
        else
        {
          Console.WriteLine("NO MATCH");
        }
      }
    }
    

    See and test this code here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a way to find/replace links to images (within user-generated content) without
Trouble! I'm looking for a way to find the countries within a given range
I've tried to find a way to do this, but without success. I'm looking
I'm looking for a way to find a string in my entire solution's code,
I am looking for a way to find the font that uses the least
Is there a way to find a Zombie at runtime in objective-c? I'm looking
I'm looking for a way to find out if there are uncommited INSERT, UPDATE
I'm looking for a way to find all classes that extend classes from particular
I'm looking for a way to find links with the colorbox-load class like this...
I am looking for a way to find the terms that matched in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.