C# Regex. Get value attribute from input html tag with specific id.

Been struggling with this for awhile.  I can't seem to figure out how to get a regex request to only return the value attribute of a particular <input> tag.  Any help is greatly appreciated.
foxygtAsked:
Who is Participating?
 
needtokenConnect With a Mentor Commented:
hai foxygt

     I added a small sample try this.
System.Text.RegularExpressions.Regex objRegEx = new System.Text.RegularExpressions.Regex("<input([\\s\\S]*?) value=[\"']([\\s\\S]*?)[\"']");
            System.Text.RegularExpressions.MatchCollection objMatchs;
            
            objMatchs =  objRegEx.Matches ("<input masdtayu=jijukijdf value=\"myvalue\"") ;

            foreach (System.Text.RegularExpressions.Match  objMatch in objMatchs)
            {
                
                MessageBox.Show(objMatch.Groups[2].Value); 
            }

Open in new window

System.Text.RegularExpressions.Regex objRegEx = new System.Text.RegularExpressions.Regex("<input([\\s\\S]*?) value=[\"']([\\s\\S]*?)[\"']");
            System.Text.RegularExpressions.MatchCollection objMatchs;
            
            objMatchs =  objRegEx.Matches ("<input masdtayu=jijukijdf value=\"myvalue\"") ;

            foreach (System.Text.RegularExpressions.Match  objMatch in objMatchs)
            {
                
                MessageBox.Show(objMatch.Groups[2].Value); 
            }

Open in new window

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.