Extract text using regex

Hi

I have the following text in a file:

("profile/happ1","profile")]

Open in new window


How can I extract just "happ1" from this using c#?

thanks
zattzAsked:
Who is Participating?
 
zattzConnect With a Mentor Author Commented:
public static string extractFrom(string html)
        {
            string anchor = "('profile/";
            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.