CS代码:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Uri u = new Uri("http://www.google.cn/search?q="+TextBox1.Text+"&hl=zh-CN&ie=GB2312&lr=&nxpt=10.2068337957705091425725");
        HttpWebRequest dd = (HttpWebRequest)WebRequest.Create(u);
        dd.Method = "GET";
        WebResponse req = dd.GetResponse();
        Stream str = req.GetResponseStream();
        StreamReader readerOfStream = new StreamReader(str, System.Text.Encoding.GetEncoding("GB2312"));
        string aa = readerOfStream.ReadToEnd();
        string abc = "";
        char aa1=(char)13;
        char aa2=(char)10;
        string Str = aa.Replace(aa1.ToString(), "").Replace(aa2.ToString(), "");
                string StartStr = "<h3 class=r>[变量]";
        StartStr = StartStr.Replace("[变量]", ".*");
        string LastStr = "</h3>";
      
        
       
        string SearchStr = StartStr + ".*" + LastStr;
        Regex re = new Regex(SearchStr, RegexOptions.IgnoreCase);
        Match m = re.Match(aa);        Response.Write(m.Value);
        str.Close();
    }
}
html代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>
    </form>
</body>
</html>