Extract text using regex

Hi

I have the following in a text file:

"username":"blah"

How could I use a regular expression to extract just "blah" using c#?

Thanks
zattzAsked:
Who is Participating?
 
zattzConnect With a Mentor Author Commented:
public static string extractTo(string html)
        {
            string anchor = "\"username\":\"";
            int startIndex = html.IndexOf(anchor) + anchor.Length;
            int endIndex = html.IndexOf('"', startIndex);
            string txt = html.Substring(startIndex, endIndex - startIndex);
            return txt;
        }
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.