Return to Snippet

Revision: 4524
at December 29, 2007 02:00 by zvasanth


Initial Code
public static string GetInputControlsNameAndValueInPage(string strPage)
        {
            string strRegExPatten = "<\\s*input.*?name\\s*=\\s*\"(?<Name>.*?)\".*?value\\s*=\\s*\"(?<Value>.*?)\".*?>";
            Regex reg = new Regex(strRegExPatten, RegexOptions.Multiline);
            MatchCollection mc = reg.Matches(strPage);
            string strTemp = string.Empty;
            foreach (Match m in mc)
            {
                strTemp = strTemp + m.Groups["Name"].Value + "=" + m.Groups["Value"].Value + "&";
            }
            int n = strTemp.Length;
            strTemp = strTemp.Remove(n - 1);
            return strTemp;
        }

Initial URL
ideabubbling.com

Initial Description
Everything is either true or untrue, or both true and untrue, or neither true nor untrue - nagarguna

Initial Title
Get Input Controls Name And Value In HTML Page

Initial Tags
regex, html, page

Initial Language
C#